Action
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Action:__new(owner: Actor, targets?: [Object], source?: Actor)
Constructor for the Action class.
@param owner — The actor that is performing the action.
@param targets — An optional list of target actors. Not all actions require targets.
@param source — An optional actor indicating the source of that action, for stuff like a wand or scroll.
_canPerform
(method) Action:_canPerform(level: Level, ...any)
-> canPerform: boolean
This method should be overriden by subclasses. This is called to make sure an action is valid for the actor. This would be useful for
_perform
(method) Action:_perform(level: Level, ...any)
Performs the action. This should be overriden on all subclasses
@param level — The level the action is being performed in.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
canPerform
(method) Action:canPerform(level: Level)
-> canPerform: boolean
Call this function to check if the action is valid and can be executed in the given level. This calls the inner overrideable _canPerform, and unpacks the target objects.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getNumTargets
(method) Action:getNumTargets()
-> numTargets: number
Returns the number of targets associated with this action.
@return numTargets — The number of targets associated with this action.
getTarget
(method) Action:getTarget(n: number)
-> target: any
Returns the target actor at the specified index.
@param n — The index of the target actor to retrieve.
@return target — The target actor at the specified index.
getTargetObject
(method) Action:getTargetObject(index: any)
-> targetObject: Target|nil
Returns the target object at the specified index. @tparam number index The index of the target object to retrieve.
hasRequisiteComponents
(method) Action:hasRequisiteComponents(actor: Actor)
-> hasRequisiteComponents: boolean
hasTarget
(method) Action:hasTarget(actor: any)
-> boolean
Determines if the specified actor is a target of this action. @tparam Actor actor The actor to check if they are a target of this action. @treturn boolean true if the specified actor is a target of this action, false otherwise.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
owner
Actor
The actor taking the action.
perform
(method) Action:perform(level: any)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
requiredComponents
Component[]
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
silent
boolean
A silent action doesn't generate messages
source
Actor?
An object granting the owner of the action this action. A wand's zap action is a good example.
stripName
boolean
targetObjects
[Object]
targets
[Target]
time
number
The time it takes to perform this action. Lower is better.
validateTarget
(method) Action:validateTarget(n: number, owner: Actor, toValidate: Actor, targets: [any])
-> true: boolean
_validates the specified target for this action.
@param n — The index of the target object to _validate.
@param owner — The actor that is performing the action.
@param toValidate — The target actor to _validate.
@param targets — The previously selected targets.
@return true — if the specified target actor is valid for this action, false otherwise.
ActionDecision
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) ActionDecision:__new(actor: Actor)
_serializationBlacklist
table
action
Action|nil
An 'Action' is a command that affects a discrete change in the game state. An Action consists of an owner, a name, a list of targets, and a list of target objects. See Target for more.
actor
Actor
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
setAction
(method) ActionDecision:setAction(action: any)
stripName
boolean
validateResponse
(method) ActionDecision:validateResponse()
-> boolean
ActionMessage
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) ActionMessage:__new(action: Action)
_serializationBlacklist
table
action
Action
An 'Action' is a command that affects a discrete change in the game state. An Action consists of an owner, a name, a list of targets, and a list of target objects. See Target for more.
actor
Actor
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
Actor
__addComponent
(method) Actor:__addComponent(component: Component)
Adds a component to the actor. This function will check if the component's prerequisites are met and will throw an error if they are not.
@param component — The component to add to the actor.
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Actor:__new()
Constructor for an actor. Initializes and copies the actor's fields from its prototype.
__removeComponent
(method) Actor:__removeComponent(component: Component)
-> unknown
Removes a component from the actor. This function will throw an error if the component is not present on the actor.
@param component — The component to remove from the actor.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
char
string
The character to draw for this actor.
className
string
A unique name for this class. By convention this should match the annotation name you use.
componentCache
table
This is a cache for component queries, reducing most queries to a hashmap lookup.
components
Component[]
A table containing all of the actor's component instances. Generated at runtime.
deserialize
function Object.deserialize(data: any)
-> unknown
expectComponent
(method) Actor:expectComponent(prototype: <T>)
-> <T>
Expects a component, returning it or erroring on nil.
@param prototype — The type of the component to return.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getActions
(method) Actor:getActions()
-> totalActions: Action[]
Get a list of actions that the actor can perform.
@return totalActions — Returns a table of all actions.
getComponent
(method) Actor:getComponent(prototype: <T>)
-> <T>?
Searches for a component that inherits from the supplied prototype
@param prototype — The type of the component to return.
getPosition
(method) Actor:getPosition()
-> position: Vector2
Returns the current position of the actor.
@return position — Returns a copy of the actor's current position.
getRange
(method) Actor:getRange(type: "4way"|"8way"|"chebyshev"|"euclidean"|"manhattan", actor: Actor)
-> Returns: number
Get the range from this actor to another actor.
@param actor — The other actor to get the range to.
@return Returns — the calculated range.
type:
| "euclidean"
| "chebyshev"
| "manhattan"
| "4way"
| "8way"
getRangeVec
(method) Actor:getRangeVec(type: any, vector: any)
-> number
Get the range from this actor to a given vector. @function Actor:getRangeVec @tparam string type The type of range calculation to use. @tparam Vector2 vector The vector to get the range to. @treturn number Returns the calculated range.
hasComponent
(method) Actor:hasComponent(prototype: Component)
-> hasComponent: boolean
Returns a bool indicating whether the actor has a component of the given type.
@param prototype — The prototype of the component to check for.
initialize
(method) Actor:initialize()
-> Component[]
Creates the components for the actor. Override this.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
The string name of the actor, used for display to the user.
position
Vector2
An actor's position in the game world.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
ActorStorage
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) ActorStorage:__new(insertSparseMapCallback: any, removeSparseMapCallback: any)
The constructor for the 'ActorStorage' class. Initializes the list, spatial map, and component cache.
_serializationBlacklist
table
actorToID
table<Actor, integer?>
A hashmap of actors to ids.
actors
Actor[]
The list of actors in the storage.
addActor
(method) ActorStorage:addActor(actor: Actor)
Adds an actor to the storage, updating the spatial map and component cache.
@param actor — The actor to add.
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
componentCache
table
The cache for storing actor components.
deserialize
function Object.deserialize(data: any)
-> unknown
eachActor
(method) ActorStorage:eachActor(...Component?)
-> iter: function
Returns an iterator over the actors in the storage. If a component is specified, only actors with that component will be returned.
@param ... — The components to filter by.
@return iter — An iterator over the actors in the storage.
eachActorAt
(method) ActorStorage:eachActorAt(x: number, y: number)
-> iterator: function
Returns an iterator over the actors in the storage at the given position.
@param x — The x-coordinate to check.
@param y — The y-coordinate to check.
@return iterator — An iterator over the actors at the given position.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getActorByType
(method) ActorStorage:getActorByType(prototype: Actor)
-> The: Actor|nil
Returns an iterator over the actors in the storage that have the specified prototype.
@param prototype — The prototype to filter by.
@return The — first actor that matches the prototype, or nil if no actor matches.
getActorsAt
(method) ActorStorage:getActorsAt(x: number, y: number)
-> actors: Actor[]
Returns a table of actors in the storage at the given position. TODO: Return an ActorStorage object instead of a table.
@param x — The x-coordinate to check.
@param y — The y-coordinate to check.
@return actors — A table of actors at the given position.
getID
(method) ActorStorage:getID(actor: Actor)
-> The: integer?
Retrieves the unique ID associated with the specified actor. Note: IDs are unique to actors within the ActorStorage but may be reused when indices are freed.
@param actor — The actor whose ID is to be retrieved.
@return The — unique ID of the actor, or nil if the actor is not found.
hasActor
(method) ActorStorage:hasActor(actor: Actor)
-> True: boolean
Returns whether the storage contains the specified actor.
@param actor — The actor to check.
@return True — if the storage contains the actor, false otherwise.
ids
SparseArray
A sparse array of references to the Actors in the storage. The ID is derived from this.
insertSparseMapCallback
function
insertSparseMapEntries
(method) ActorStorage:insertSparseMapEntries(actor: Actor)
Inserts the specified actor into the spatial map.
@param actor — The actor to insert.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
merge
(method) ActorStorage:merge(other: ActorStorage)
Merges another ActorStorage instance with this one.
@param other — The other ActorStorage instance to merge with this one.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
onDeserialize
(method) ActorStorage:onDeserialize()
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) ActorStorage:removeActor(actor: Actor)
Removes an actor from the storage, updating the spatial map and component cache.
@param actor — The actor to remove.
removeComponentCache
(method) ActorStorage:removeComponentCache(actor: Actor)
Removes the specified actor from the component cache.
@param actor — The actor to remove from the component cache.
removeSparseMapCallback
function
removeSparseMapEntries
(method) ActorStorage:removeSparseMapEntries(actor: Actor)
Removes the specified actor from the spatial map.
@param actor — The actor to remove.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
setCallbacks
(method) ActorStorage:setCallbacks(insertCallback: any, removeCallback: any)
sparseMap
SparseMap
The spatial map for storing actor positions.
stripName
boolean
updateComponentCache
(method) ActorStorage:updateComponentCache(actor: Actor)
Updates the component cache for the specified actor.
@param actor — The actor to update the component cache for.
BTConditional
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) BTConditional:__new(conditionFunc: fun(self: any, level: Level, actor: Actor):boolean)
Creates a new BTConditional.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
behaviorOwner
IBehavior?
className
string
A unique name for this class. By convention this should match the annotation name you use.
conditionFunc
fun(self: any, level: Level, actor: Actor):boolean
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
run
(method) BTConditional:run(level: Level, actor: Actor, controller: ControllerComponent)
-> boolean|Action
Runs the conditional node.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
BTNode
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) BTNode:__new(run: fun(self: BTNode, level: Level, actor: Actor, controller: ControllerComponent):boolean|Action)
You can also construct an anonymous node like: prism.BTNode(function(level, actor) return true end) For this reason simple nodes like succeeders, inverters, failers etc. should just be created using these anonymous nodes.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
behaviorOwner
IBehavior?
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
run
fun(self: BTNode, level: Level, actor: Actor, controller: ControllerComponent):boolean|Action
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
BTRoot
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) BTRoot:__new(children: BTNode[])
Creates a new BTRoot.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
behaviorOwner
IBehavior?
children
BTNode[]
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
run
(method) BTRoot:run(level: Level, actor: Actor, controller: ControllerComponent)
-> Action
Runs the behavior tree starting from this root node.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
BTSelector
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) BTSelector:__new(children: BTNode[])
Creates a new BTSelector.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
behaviorOwner
IBehavior?
children
BTNode[]
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
run
(method) BTSelector:run(level: Level, actor: Actor, controller: ControllerComponent)
-> boolean|Action
Runs the selector node.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
BTSequence
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) BTSequence:__new(children: BTNode[])
Creates a new BTSequence.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
behaviorOwner
IBehavior?
children
BTNode[]
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
run
(method) BTSequence:run(level: Level, actor: Actor, controller: ControllerComponent)
-> boolean|Action
Runs the sequence node.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
BTSucceeder
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) BTSucceeder:__new(node: BTNode)
Creates a new BTSucceeder.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
behaviorOwner
IBehavior?
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
node
BTNode
The base class for all nodes in the behavior tree.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
run
(method) BTSucceeder:run(level: Level, actor: Actor, controller: ControllerComponent)
-> boolean|Action
Runs the succeeder node.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
Bitmask
BitmaskBuffer
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) BitmaskBuffer:__new(w: integer, h: integer)
Constructor for the BitmaskBuffer class.
@param w — The width of the buffer.
@param h — The height of the buffer.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
buffer
ffi.cdata*
Initialize the buffer with zeroed 16-bit values
className
string
A unique name for this class. By convention this should match the annotation name you use.
clear
(method) BitmaskBuffer:clear()
Clear the buffer, setting all values to zero.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getBit
(method) BitmaskBuffer:getBit(x: integer, y: integer, bitIndex: integer)
-> value: boolean
Get the value of a specific bit at the given coordinates.
@param x — The x-coordinate (1-based).
@param y — The y-coordinate (1-based).
@param bitIndex — The bit index (0-15) to retrieve.
@return value — The value of the bit (true if set, false if not).
getIndex
(method) BitmaskBuffer:getIndex(x: integer, y: integer)
-> index: integer
Calculate the index in the buffer array for the given coordinates.
@param x — The x-coordinate (1-based).
@param y — The y-coordinate (1-based).
@return index — The corresponding index in the buffer array.
getMask
(method) BitmaskBuffer:getMask(x: integer, y: integer)
-> value: integer
Get the full 16-bit mask value at the given coordinates.
@param x — The x-coordinate (1-based).
@param y — The y-coordinate (1-based).
@return value — The 16-bit mask value.
h
integer
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
setBit
(method) BitmaskBuffer:setBit(x: integer, y: integer, bitIndex: integer, v: boolean)
Set a specific bit at the given coordinates.
@param x — The x-coordinate (1-based).
@param y — The y-coordinate (1-based).
@param bitIndex — The bit index (0-15) to set.
@param v — The value to set (true to set, false to clear).
setMask
(method) BitmaskBuffer:setMask(x: integer, y: integer, value: integer)
Set the full 16-bit mask value at the given coordinates.
@param x — The x-coordinate (1-based).
@param y — The y-coordinate (1-based).
@param value — The 16-bit value to set.
stripName
boolean
w
integer
BooleanBuffer
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) BooleanBuffer:__new(w: integer, h: integer)
Constructor for the BooleanBuffer class.
@param w — The width of the buffer.
@param h — The height of the buffer.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
buffer
ffi.cdata*
Initialize the buffer with false values
className
string
A unique name for this class. By convention this should match the annotation name you use.
clear
(method) BooleanBuffer:clear()
Clear the buffer, setting all values to false.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
get
(method) BooleanBuffer:get(x: integer, y: integer)
-> value: boolean
Get the value at the given coordinates.
@param x — The x-coordinate (1-based).
@param y — The y-coordinate (1-based).
@return value — The value at the given coordinates.
getIndex
(method) BooleanBuffer:getIndex(x: integer, y: integer)
-> index: integer
Calculate the index in the buffer array for the given coordinates.
@param x — The x-coordinate (1-based).
@param y — The y-coordinate (1-based).
@return index — The corresponding index in the buffer array.
h
integer
The height of the buffer.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
set
(method) BooleanBuffer:set(x: integer, y: integer, v: boolean)
Set the value at the given coordinates.
@param x — The x-coordinate (1-based).
@param y — The y-coordinate (1-based).
@param v — The value to set.
stripName
boolean
w
integer
The width of the buffer.
BoundingBox
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) BoundingBox:__new(x: any, y: any, i: any, j: any)
__tostring
(method) BoundingBox:__tostring()
-> string
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
contains
(method) BoundingBox:contains(x: any, y: any)
-> boolean
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getHeight
(method) BoundingBox:getHeight()
-> unknown
getWidth
(method) BoundingBox:getWidth()
-> unknown
i
any
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
intersects
(method) BoundingBox:intersects(other: any)
-> boolean
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
j
any
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
union
(method) BoundingBox:union(other: any)
-> BoundingBox
x
any
y
any
Button
__getInternal
(method) Inky.Element:__getInternal()
-> Inky.Element.Internal
Get the internal representation of the Element
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Element.Internal
constructor
(method) Inky.Element:constructor(scene: any, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
getView
(method) Inky.Element:getView()
-> x: number
2. y: number
3. w: number
4. h: number
Return the x, y, w, h that the Element was last rendered at
on
(method) Inky.Element:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element
Execute callback when Scene event is raised from the parent Scene \
See: Inky.Scene.raise
onDisable
(method) Inky.Element:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element isn't rendered, when it was rendered last frame
onEnable
(method) Inky.Element:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element is rendered, when it wasn't rendered last frame
onPointer
(method) Inky.Element:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event is raised from an overlapping/capturing Pointer \
See: * Inky.Pointer.raise * Inky.Pointer.captureElement
onPointerEnter
(method) Inky.Element:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer enters the bounding box of the Element
onPointerExit
(method) Inky.Element:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer exits the bounding box of the Element
onPointerInHierarchy
(method) Inky.Element:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event was accepted by a child Element \
See: * Inky.Pointer.raise * Inky.Element.onPointer
props
ButtonProps
render
(method) Inky.Element:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element
Render the Element, setting up all the hooks and drawing the Element
Note: The parent Scene's frame must have been begun to be able to render\
useEffect
(method) Inky.Element:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element
Execute a side effect when any specified Element's prop changes
Note: The effect is ran right before a render
useOverlapCheck
(method) Inky.Element:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element
Use an additional check to determine if a Pointer is overlapping an Element
Note: Check is performed after a bounding box check
ButtonInit
ButtonProps
_internal
Inky.Props.Internal
disabled
boolean
disabledQuad
love.Quad
A quadrilateral (a polygon with four sides and four corners) with texture coordinate information.
Quads can be used to select part of a texture to draw. In this way, one large texture atlas can be loaded, and then split up into sub-images.
hovered
boolean
hoveredQuad
love.Quad
A quadrilateral (a polygon with four sides and four corners) with texture coordinate information.
Quads can be used to select part of a texture to draw. In this way, one large texture atlas can be loaded, and then split up into sub-images.
onPress
fun(pointer: Inky.Pointer)?
a function called after pressing the button
onRelease
fun(pointer: Inky.Pointer)?
a function called after releasing the button
pressed
boolean
whether the button is pressed
pressedQuad
love.Quad
A quadrilateral (a polygon with four sides and four corners) with texture coordinate information.
Quads can be used to select part of a texture to draw. In this way, one large texture atlas can be loaded, and then split up into sub-images.
tileset
love.Image
Drawable image type.
toggle
boolean
whether the button stays pressed after clicking
unpressedQuad
love.Quad
A quadrilateral (a polygon with four sides and four corners) with texture coordinate information.
Quads can be used to select part of a texture to draw. In this way, one large texture atlas can be loaded, and then split up into sub-images.
untoggle
boolean
if the button is toggleable, whether you can untoggle
Camera
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Camera:__new(x: any, y: any)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getPosition
(method) Camera:getPosition()
-> x: number
2. y: number
@return x — The x position.
@return y — The y position.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
move
(method) Camera:move(dx: number, dy: number)
pop
(method) Camera:pop()
Pops the camera's transform. Call this after drawing.
position
Vector2
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
push
(method) Camera:push()
Pushes the camera's transform. Call this before drawing.
rotation
number
scale
Vector2
scaleAroundPoint
(method) Camera:scaleAroundPoint(factorX: number, factorY: number, pointX: number, pointY: number)
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
setPosition
(method) Camera:setPosition(x: number, y: number)
setRotation
(method) Camera:setRotation(rotation: number)
setScale
(method) Camera:setScale(scaleX: number, scaleY: number)
stripName
boolean
toWorldSpace
(method) Camera:toWorldSpace(x: number, y: number)
-> number
2. number
Cell
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Cell:__new()
Constructor for the Cell class.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
afterAction
(method) Cell:afterAction(level: Level, actor: Actor, action: Action)
Called right after an action is taken on the cell.
@param level — The level where the action took place.
@param actor — The actor that took the action.
@param action — The action that was taken.
allowedMovetypes
string[]?
beforeAction
(method) Cell:beforeAction(level: Level, actor: Actor, action: Action)
Called right before an action takes place on this cell.
className
string
A unique name for this class. By convention this should match the annotation name you use.
collisionMask
integer
Defines whether a cell can moved through.
deserialize
function Object.deserialize(data: any)
-> unknown
drawable
DrawableComponent
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getComponent
(method) Cell:getComponent(component: any)
-> DrawableComponent
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
Displayed in the user interface.
onEnter
(method) Cell:onEnter(level: Level, actor: Actor)
Called when an actor enters the cell.
@param level — The level where the actor entered the cell.
@param actor — The actor that entered the cell.
onLeave
(method) Cell:onLeave(level: Level, actor: Actor)
Called when an actor leaves the cell.
@param level — The level where the actor left the cell.
@param actor — The actor that left the cell.
opaque
boolean
Defines whether a cell can be seen through.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
ColliderComponent
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) ColliderComponent:__new(options: ColliderOptions)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
checkRequirements
(method) Component:checkRequirements(actor: Actor)
-> meetsRequirements: boolean
Checks whether an actor has the required components to attach this component.
@param actor — The actor to check the requirements against.
@return meetsRequirements — the actor meets all requirements, false otherwise.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
initialize
(method) Component:initialize(owner: Actor)
Called after the actor is loaded and ready, this is where the component should do any initialization requiring the actor. This would include stuff like attaching systems, etc.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mask
integer
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
owner
Actor
The Actor this component is composing. This is set by Actor when a component is added or removed.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
requirements
table
A list of component prototypes the actor must first have, before this can be applied.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
ColliderOptions
allowedMovetypes
string[]
CollisionMask
Color4
BLACK
Color4
Predefined colors
BLUE
Color4
GREEN
Color4
RED
Color4
TRANSPARENT
Color4
WHITE
Color4
__add
function Color4.__add(a: Color4, b: Color4)
-> The: Color4
Adds two colors together.
@param a — The first color.
@param b — The second color.
@return The — sum of the two colors.
__call
function
__eq
function Color4.__eq(a: Color4, b: Color4)
-> True: boolean
Checks equality between two colors.
@param a — The first color.
@param b — The second color.
@return True — if the colors are equal, false otherwise.
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__mul
function Color4.__mul(self: Color4, scalar: number)
-> The: Color4
Multiplies the color's components by a scalar.
@param scalar — The scalar value.
@return The — scaled color.
__new
(method) Color4:__new(r: number, g: number, b: number, a: number)
Constructor for Color4 accepts red, green, blue, and alpha values.
@param r — The red component (0-1).
@param g — The green component (0-1).
@param b — The blue component (0-1).
@param a — The alpha component (0-1).
__sub
function Color4.__sub(a: Color4, b: Color4)
-> The: Color4
Subtracts one color from another.
@param a — The first color.
@param b — The second color.
@return The — difference of the two colors.
__tostring
(method) Color4:__tostring()
-> The: string
Creates a string representation of the color.
@return The — string representation.
__unm
function Color4.__unm(self: Color4)
-> The: Color4
Negates the color's components.
@return The — negated color.
_serializationBlacklist
table
a
number
The alpha component (0-1).
adopt
(method) Object:adopt(o: any)
-> unknown
b
number
The blue component (0-1).
clamp
(method) Color4:clamp()
-> The: Color4
Clamps the components of the color between 0 and 1.
@return The — clamped color.
className
string
A unique name for this class. By convention this should match the annotation name you use.
copy
(method) Color4:copy()
-> A: Color4
Returns a copy of the color.
@return A — copy of the color.
decompose
(method) Color4:decompose()
-> r: number
2. g: number
3. b: number
4. a: number
Returns the components of the color as numbers.
@return r,g,b,a — The components of the color.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
fromHex
function Color4.fromHex(hex: number)
Constructor for Color4 that accepts a hexadecimal number.
@param hex — A hex number representing a color, e.g. 0xFFFFFF. Alpha is optional and defaults to 1.
g
number
The green component (0-1).
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
lerp
(method) Color4:lerp(target: Color4, t: number)
-> The: Color4
Linearly interpolates between two colors.
@param target — The target color.
@param t — A value between 0 and 1, where 0 is this color and 1 is the target color.
@return The — interpolated color.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
r
number
The red component (0-1).
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
Component
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
checkRequirements
(method) Component:checkRequirements(actor: Actor)
-> meetsRequirements: boolean
Checks whether an actor has the required components to attach this component.
@param actor — The actor to check the requirements against.
@return meetsRequirements — the actor meets all requirements, false otherwise.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
initialize
(method) Component:initialize(owner: Actor)
Called after the actor is loaded and ready, this is where the component should do any initialization requiring the actor. This would include stuff like attaching systems, etc.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
Each component prototype MUST have a unique name!
owner
Actor
The Actor this component is composing. This is set by Actor when a component is added or removed.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
requirements
table
A list of component prototypes the actor must first have, before this can be applied.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
ControllerComponent
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
act
(method) ControllerComponent:act(level: any, actor: any)
-> Action
adopt
(method) Object:adopt(o: any)
-> unknown
blackboard
table|nil
checkRequirements
(method) Component:checkRequirements(actor: Actor)
-> meetsRequirements: boolean
Checks whether an actor has the required components to attach this component.
@param actor — The actor to check the requirements against.
@return meetsRequirements — the actor meets all requirements, false otherwise.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
initialize
(method) Component:initialize(owner: Actor)
Called after the actor is loaded and ready, this is where the component should do any initialization requiring the actor. This would include stuff like attaching systems, etc.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
owner
Actor
The Actor this component is composing. This is set by Actor when a component is added or removed.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
requirements
table
A list of component prototypes the actor must first have, before this can be applied.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
DebugMessage
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) DebugMessage:__new(message: string)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
message
string
A human readable message for why we stopped her.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
Decision
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
actor
Actor
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
validateResponse
(method) Decision:validateResponse()
Display
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Display:__new(spriteAtlas: SpriteAtlas, cellSize: Vector2, attachable: SpectrumAttachable)
Initializes a new Display instance.
@param spriteAtlas — The sprite atlas for rendering.
@param cellSize — Size of each cell in pixels.
@param attachable — Object containing cells and actors to render.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
afterDrawActors
(method) Display:afterDrawActors()
Hook for custom behavior after drawing actors.
attachable
SpectrumAttachable
The current level being displayed.
beforeDrawActors
(method) Display:beforeDrawActors()
Hook for custom behavior before drawing actors.
beforeDrawCells
(method) Display:beforeDrawCells()
Hook for custom behavior before drawing cells.
buildSenseInfo
function Display.buildSenseInfo(primary: SensesComponent[], secondary: SensesComponent[])
-> SparseGrid
2. SparseGrid
3. table
4. table
5. SparseGrid
@param primary — List of primary senses.
@param secondary — List of secondary senses.
camera
Camera
The camera used to render the display.
cellSize
Vector2
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) Display:draw()
Renders the display.
drawActor
(method) Display:drawActor(actor: Actor, alpha?: number, color?: Color4, drawnSet?: table, x: any, y: any)
Draws an actor.
@param actor — The actor to draw.
@param alpha — Optional alpha transparency.
@param color — Optional color tint.
@param drawnSet — Optional set to track drawn actors.
drawDrawable
function Display.drawDrawable(drawable: DrawableComponent, spriteAtlas: SpriteAtlas, cellSize: Vector2, x: integer, y: integer, color?: Color4, alpha?: number)
Draws a drawable object.
@param drawable — Drawable to render.
@param spriteAtlas — Sprite atlas to use.
@param cellSize — Size of each cell.
@param x — X-coordinate.
@param y — Y-coordinate.
@param color — Optional color tint.
@param alpha — Optional alpha transparency.
drawPerspective
(method) Display:drawPerspective(primary: SensesComponent[], secondary: SensesComponent[])
Draws the perspective of primary and secondary senses.
@param primary — List of primary senses.
@param secondary — List of secondary senses.
dt
number
Delta time for updates.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getCellUnderMouse
(method) Display:getCellUnderMouse()
-> integer
2. The: integer
Gets the cell under the mouse cursor.
@return The — X and Y coordinates of the cell.
getQuad
function Display.getQuad(spriteAtlas: SpriteAtlas, drawable: DrawableComponent)
-> The: love.Quad|nil
Retrieves the quad for a drawable.
@param spriteAtlas — The sprite atlas.
@param drawable — The drawable component.
@return The — quad used for rendering.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
message
nil
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
override
fun(dt: integer, drawnSet: table<Actor, boolean>)|nil
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
setOverride
(method) Display:setOverride(functionFactory: fun(display: Display, message: any):fun(dt: number):boolean, message: any)
Sets an override rendering function.
@param functionFactory — A factory for override functions.
@param message — Optional message to pass to the function.
spriteAtlas
SpriteAtlas
The sprite atlas used for rendering graphics.
stripName
boolean
update
(method) Display:update(dt: number)
Updates the display state.
@param dt — Delta time for updates.
DistanceType
DrawableComponent
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) DrawableComponent:__new(index: string|integer, color: Color4)
Index needs to be a string associated with a sprite in the SpriteAtlas, or an integer index associated with a sprite.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
checkRequirements
(method) Component:checkRequirements(actor: Actor)
-> meetsRequirements: boolean
Checks whether an actor has the required components to attach this component.
@param actor — The actor to check the requirements against.
@return meetsRequirements — the actor meets all requirements, false otherwise.
className
string
A unique name for this class. By convention this should match the annotation name you use.
color
Color4
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
index
string|integer
initialize
(method) Component:initialize(owner: Actor)
Called after the actor is loaded and ready, this is where the component should do any initialization requiring the actor. This would include stuff like attaching systems, etc.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
Each component prototype MUST have a unique name!
owner
Actor
The Actor this component is composing. This is set by Actor when a component is added or removed.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
requirements
table
A list of component prototypes the actor must first have, before this can be applied.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
Editor
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Editor:__new(attachable: any, display: any, fileEnabled: any)
_serializationBlacklist
table
active
boolean
adopt
(method) Object:adopt(o: any)
-> unknown
attachable
SpectrumAttachable
camera
Camera
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
display
Display
draw
(method) Editor:draw()
editorRoot
EditorRoot
execute
(method) Editor:execute(modification: Modification)
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
fileEnabled
boolean
filepath
string|nil
fillMode
boolean
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
isActive
(method) Editor:isActive()
-> boolean
keybindsEnabled
boolean
keypressed
(method) Editor:keypressed(key: any, scancode: any)
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mousemoved
(method) Editor:mousemoved(x: any, y: any, dx: any, dy: any, istouch: any)
mousepressed
(method) Editor:mousepressed(x: any, y: any, button: any)
mousereleased
(method) Editor:mousereleased(x: any, y: any, button: any)
placeable
Actor|Cell|nil
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
redo
(method) Editor:redo()
redoStack
Modification[]
selectorMode
string
selectorModes
table<string, string>
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
setAttachable
(method) Editor:setAttachable(attachable: SpectrumAttachable)
startEditing
(method) Editor:startEditing()
stripName
boolean
textinput
(method) Editor:textinput(text: any)
tool
Tool
undo
(method) Editor:undo()
undoStack
Modification[]
update
(method) Editor:update(dt: any)
wheelmoved
(method) Editor:wheelmoved(dx: any, dy: any)
EditorGrid
__getInternal
(method) Inky.Element:__getInternal()
-> Inky.Element.Internal
Get the internal representation of the Element
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Element.Internal
constructor
(method) Inky.Element:constructor(scene: any, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
getView
(method) Inky.Element:getView()
-> x: number
2. y: number
3. w: number
4. h: number
Return the x, y, w, h that the Element was last rendered at
on
(method) Inky.Element:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element
Execute callback when Scene event is raised from the parent Scene \
See: Inky.Scene.raise
onDisable
(method) Inky.Element:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element isn't rendered, when it was rendered last frame
onEnable
(method) Inky.Element:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element is rendered, when it wasn't rendered last frame
onPointer
(method) Inky.Element:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event is raised from an overlapping/capturing Pointer \
See: * Inky.Pointer.raise * Inky.Pointer.captureElement
onPointerEnter
(method) Inky.Element:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer enters the bounding box of the Element
onPointerExit
(method) Inky.Element:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer exits the bounding box of the Element
onPointerInHierarchy
(method) Inky.Element:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event was accepted by a child Element \
See: * Inky.Pointer.raise * Inky.Element.onPointer
props
EditorGridProps
render
(method) Inky.Element:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element
Render the Element, setting up all the hooks and drawing the Element
Note: The parent Scene's frame must have been begun to be able to render\
useEffect
(method) Inky.Element:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element
Execute a side effect when any specified Element's prop changes
Note: The effect is ran right before a render
useOverlapCheck
(method) Inky.Element:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element
Use an additional check to determine if a Pointer is overlapping an Element
Note: Check is performed after a bounding box check
EditorGridInit
EditorGridProps
_internal
Inky.Props.Internal
attachable
SpectrumAttachable
display
Display
editor
Editor
offset
Vector2
scale
Vector2
EditorRoot
__getInternal
(method) Inky.Element:__getInternal()
-> Inky.Element.Internal
Get the internal representation of the Element
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Element.Internal
constructor
(method) Inky.Element:constructor(scene: any, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
getView
(method) Inky.Element:getView()
-> x: number
2. y: number
3. w: number
4. h: number
Return the x, y, w, h that the Element was last rendered at
on
(method) Inky.Element:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element
Execute callback when Scene event is raised from the parent Scene \
See: Inky.Scene.raise
onDisable
(method) Inky.Element:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element isn't rendered, when it was rendered last frame
onEnable
(method) Inky.Element:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element is rendered, when it wasn't rendered last frame
onPointer
(method) Inky.Element:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event is raised from an overlapping/capturing Pointer \
See: * Inky.Pointer.raise * Inky.Pointer.captureElement
onPointerEnter
(method) Inky.Element:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer enters the bounding box of the Element
onPointerExit
(method) Inky.Element:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer exits the bounding box of the Element
onPointerInHierarchy
(method) Inky.Element:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event was accepted by a child Element \
See: * Inky.Pointer.raise * Inky.Element.onPointer
props
EditorRootProps
render
(method) Inky.Element:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element
Render the Element, setting up all the hooks and drawing the Element
Note: The parent Scene's frame must have been begun to be able to render\
useEffect
(method) Inky.Element:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element
Execute a side effect when any specified Element's prop changes
Note: The effect is ran right before a render
useOverlapCheck
(method) Inky.Element:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element
Use an additional check to determine if a Pointer is overlapping an Element
Note: Check is performed after a bounding box check
EditorRootProps
_internal
Inky.Props.Internal
attachable
SpectrumAttachable
display
Display
editor
Editor
gridPosition
Vector2
quit
boolean
scale
Vector2
EditorState
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) EditorState:__new(attachable: SpectrumAttachable, display: any, fileEnabled: any)
Create a new Editor managing gamestate, attached to a SpectrumAttachable, this is a Level|MapBuilder interface.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) EditorState:draw()
editor
Editor
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getManager
(method) GameState:getManager()
-> GameStateManager
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
keypressed
(method) EditorState:keypressed(key: any, scancode: any)
load
(method) EditorState:load()
manager
GameStateManager
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mousemoved
(method) EditorState:mousemoved(x: any, y: any, dx: any, dy: any, istouch: any)
mousepressed
(method) EditorState:mousepressed(x: any, y: any, button: any)
mousereleased
(method) EditorState:mousereleased(x: any, y: any, button: any)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
textinput
(method) EditorState:textinput(text: any)
unload
(method) GameState:unload()
Calls when the gamestate is stopped.
update
(method) EditorState:update(dt: any)
wheelmoved
(method) EditorState:wheelmoved(dx: any, dy: any)
EllipseModification
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) EllipseModification:__new(placeable: Actor|Cell, center: any, rx: any, ry: any)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
bottomright
Vector2
center
any
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
execute
(method) EllipseModification:execute(attachable: SpectrumAttachable, editor: Editor)
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
placeActor
(method) Modification:placeActor(attachable: SpectrumAttachable, x: integer, y: integer, actorPrototype: Actor)
placeCell
(method) Modification:placeCell(attachable: SpectrumAttachable, x: integer, y: integer, cellPrototype: Cell|nil)
placeable
Actor|Cell
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
placed
Actor|Cell[]|nil
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) Modification:removeActor(level: any, actor: any)
removed
table
replaced
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
rx
any
ry
any
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
topleft
Vector2
undo
(method) Modification:undo(attachable: SpectrumAttachable)
Undoes the modification. Override this method in subclasses to define how the modification is undone.
EllipseTool
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
center
Vector2
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) EllipseTool:draw(editor: Editor, display: Display)
drawCell
(method) Tool:drawCell(display: Display, drawable: DrawableComponent, x: number, y: number)
Draws a cell at the given coordinates.
editor
Editor
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getDrawable
(method) Tool:getDrawable(placeable: Actor|Cell)
-> DrawableComponent
Returns the DrawableComponent from placeable
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mouseclicked
(method) EllipseTool:mouseclicked(editor: Editor, attachable: any, x: number, y: number)
mousereleased
(method) EllipseTool:mousereleased(editor: Editor, level: any, x: number, y: number)
overrideCellDraw
(method) Tool:overrideCellDraw(editor: Editor, level: Level, cellx: integer, celly: integer)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
update
(method) Tool:update(dt: number, editor: Editor)
Updates the tool state.
@param dt — The time delta since the last update.
@param editor — The editor instance.
EraseModification
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) EraseModification:__new(placeable: Actor|Cell, topleft: Vector2, bottomright: Vector2)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
bottomright
Vector2
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
execute
(method) EraseModification:execute(attachable: SpectrumAttachable)
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
placeActor
(method) Modification:placeActor(attachable: SpectrumAttachable, x: integer, y: integer, actorPrototype: Actor)
placeCell
(method) Modification:placeCell(attachable: SpectrumAttachable, x: integer, y: integer, cellPrototype: Cell|nil)
placeable
Actor|Cell
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
placed
Actor|Cell[]|nil
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) Modification:removeActor(level: any, actor: any)
removed
table
replaced
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
topleft
Vector2
undo
(method) Modification:undo(attachable: SpectrumAttachable)
Undoes the modification. Override this method in subclasses to define how the modification is undone.
EraseTool
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) EraseTool:__new()
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) EraseTool:draw(editor: Editor, display: Display)
drawCell
(method) Tool:drawCell(display: Display, drawable: DrawableComponent, x: number, y: number)
Draws a cell at the given coordinates.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getCurrentRect
(method) EraseTool:getCurrentRect()
-> topleftx: number?
2. toplefy: number?
3. bottomrightx: number?
4. bottomrighty: number?
Returns the four corners of the current rect.
getDrawable
(method) Tool:getDrawable(placeable: Actor|Cell)
-> DrawableComponent
Returns the DrawableComponent from placeable
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mouseclicked
(method) EraseTool:mouseclicked(editor: Editor, attached: SpectrumAttachable, x: integer, y: integer)
@param x — The cell coordinate clicked.
@param y — The cell coordinate clicked.
mousereleased
(method) EraseTool:mousereleased(editor: Editor, attached: SpectrumAttachable, x: integer, y: integer)
-> nil
@param x — The cell coordinate clicked.
@param y — The cell coordinate clicked.
origin
Vector2
overrideCellDraw
(method) Tool:overrideCellDraw(editor: Editor, level: Level, cellx: integer, celly: integer)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
second
Vector2
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
update
(method) EraseTool:update(dt: number, editor: Editor)
FilePanel
__getInternal
(method) Inky.Element:__getInternal()
-> Inky.Element.Internal
Get the internal representation of the Element
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Element.Internal
constructor
(method) Inky.Element:constructor(scene: any, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
getView
(method) Inky.Element:getView()
-> x: number
2. y: number
3. w: number
4. h: number
Return the x, y, w, h that the Element was last rendered at
on
(method) Inky.Element:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element
Execute callback when Scene event is raised from the parent Scene \
See: Inky.Scene.raise
onDisable
(method) Inky.Element:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element isn't rendered, when it was rendered last frame
onEnable
(method) Inky.Element:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element is rendered, when it wasn't rendered last frame
onPointer
(method) Inky.Element:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event is raised from an overlapping/capturing Pointer \
See: * Inky.Pointer.raise * Inky.Pointer.captureElement
onPointerEnter
(method) Inky.Element:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer enters the bounding box of the Element
onPointerExit
(method) Inky.Element:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer exits the bounding box of the Element
onPointerInHierarchy
(method) Inky.Element:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event was accepted by a child Element \
See: * Inky.Pointer.raise * Inky.Element.onPointer
props
FilePanelProps
render
(method) Inky.Element:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element
Render the Element, setting up all the hooks and drawing the Element
Note: The parent Scene's frame must have been begun to be able to render\
useEffect
(method) Inky.Element:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element
Execute a side effect when any specified Element's prop changes
Note: The effect is ran right before a render
useOverlapCheck
(method) Inky.Element:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element
Use an additional check to determine if a Pointer is overlapping an Element
Note: Check is performed after a bounding box check
FilePanelInit
FilePanelProps
_internal
Inky.Props.Internal
editor
Editor
name
string
open
boolean
overlay
love.Canvas
A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as "render to texture".
By drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.
In versions prior to love.graphics.isSupported("canvas") could be used to check for support at runtime.
scale
Vector2
Fill
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
bucket
(method) Fill:bucket(attachable: SpectrumAttachable, x: any, y: any)
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) Tool:draw(editor: Editor, display: Display)
Draws the tool visuals.
drawCell
(method) Tool:drawCell(display: Display, drawable: DrawableComponent, x: number, y: number)
Draws a cell at the given coordinates.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getDrawable
(method) Tool:getDrawable(placeable: Actor|Cell)
-> DrawableComponent
Returns the DrawableComponent from placeable
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
locations
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mouseclicked
(method) Fill:mouseclicked(editor: Editor, level: Level, cellx: number, celly: number)
Begins a paint drag.
@param cellx — The x-coordinate of the cell clicked.
@param celly — The y-coordinate of the cell clicked.
mousereleased
(method) Tool:mousereleased(editor: Editor, level: any, cellx: number, celly: number)
Handles mouse release events.
@param cellx — The x-coordinate of the cell release.
@param celly — The y-coordinate of the cell release.
overrideCellDraw
(method) Tool:overrideCellDraw(editor: Editor, level: Level, cellx: integer, celly: integer)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
update
(method) Fill:update(dt: number, editor: Editor)
Updates the tool state.
@param dt — The time delta since the last update.
Fraction
__add
function Fraction.__add(lhs: any, rhs: any)
__call
function
__eq
function Fraction.__eq(lhs: any, rhs: any)
-> boolean
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__le
function Fraction.__le(lhs: any, rhs: any)
-> boolean
__lt
function Fraction.__lt(lhs: any, rhs: any)
-> boolean
__mul
(method) Fraction:__mul(other: any)
__new
(method) Fraction:__new(numerator: any, denominator: any)
__sub
function Fraction.__sub(lhs: any, rhs: any)
__tostring
(method) Fraction:__tostring()
-> unknown
__unm
(method) Fraction:__unm()
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
denominator
any
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
numerator
any
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
tonumber
(method) Fraction:tonumber()
-> unknown
GameState
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) GameState:draw()
Called on each draw.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getManager
(method) GameState:getManager()
-> GameStateManager
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
keypressed
(method) GameState:keypressed(key: any, scancode: any)
Called on each keypress.
load
(method) GameState:load()
Called when the gamestate is started.
manager
GameStateManager
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mousepressed
(method) GameState:mousepressed(x: any, y: any, button: any, istouch: any, presses: any)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
unload
(method) GameState:unload()
Calls when the gamestate is stopped.
update
(method) GameState:update(dt: any)
Called on each update.
wheelmoved
(method) GameState:wheelmoved(dx: any, dy: any)
Called when the mouse wheel is moved.
GameStateManager
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) GameStateManager:__new()
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) GameStateManager:draw()
Called each draw, calls draw on top state in stack.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
keypressed
(method) GameStateManager:keypressed(key: any, scancode: any)
Called on keypress, calls keypressed on top state in stack
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mousemoved
(method) GameStateManager:mousemoved(x: any, y: any, dx: any, dy: any, istouch: any)
mousepressed
(method) GameStateManager:mousepressed(x: any, y: any, button: any, istouch: any, presses: any)
mousereleased
(method) GameStateManager:mousereleased(x: any, y: any, button: any)
pop
(method) GameStateManager:pop()
-> unknown
Pops the state from the top of the stack.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
push
(method) GameStateManager:push(state: GameState)
@param state — State to push to the top of the stack.
replace
(method) GameStateManager:replace(state: GameState)
@param state — Swap the top of the stack with this state.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stateStack
table
stripName
boolean
textinput
(method) GameStateManager:textinput(text: any)
update
(method) GameStateManager:update(dt: any)
Called each update, calls update on top state in stack.
wheelmoved
(method) GameStateManager:wheelmoved(dx: any, dy: any)
Grid
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Grid:__new(w: integer, h: integer, initialValue: <T>)
-> The: Grid<<T>>
The constructor for the 'Grid' class. Initializes the grid with the specified dimensions and initial value.
@param w — The width of the grid.
@param h — The height of the grid.
@param initialValue — The initial value to fill the grid with.
@return The — initialized grid.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
data
any[]
The data stored in the grid.
deserialize
function Object.deserialize(data: any)
-> unknown
each
(method) Grid:each()
-> An: fun():number, number, <T>
Iterates over each cell in the grid, yielding x, y, and the value.
@return An — iterator returning x, y, and value for each cell.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
fill
(method) Grid:fill(value: <T>)
Fills the entire grid with the specified value.
@param value — The value to fill the grid with.
fromData
(method) Grid:fromData(w: integer, h: integer, data: <T>[])
-> The: Grid<<T>>
Initializes the grid with the specified dimensions and data.
@param w — The width of the grid.
@param h — The height of the grid.
@param data — The data to fill the grid with.
@return The — initialized grid.
get
(method) Grid:get(x: integer, y: integer)
-> value: <T>?
Gets the value at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@return value — The value at the specified coordinates, or nil if out of bounds.
getIndex
(method) Grid:getIndex(x: integer, y: integer)
-> The: number?
Gets the index in the data array for the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@return The — index in the data array, or nil if out of bounds.
h
integer
The height of the grid.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
set
(method) Grid:set(x: integer, y: integer, value: <T>)
Sets the value at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@param value — The value to set.
stripName
boolean
w
integer
The width of the grid.
IBehavior
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
behaviorOwner
IBehavior?
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
run
fun(self: any, level: Level, actor: Actor, controller: ControllerComponent):Action
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
Inky.Element
__getInternal
(method) Inky.Element:__getInternal()
-> Inky.Element.Internal
Get the internal representation of the Element
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Element.Internal
constructor
(method) Inky.Element:constructor(scene: any, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
getView
(method) Inky.Element:getView()
-> x: number
2. y: number
3. w: number
4. h: number
Return the x, y, w, h that the Element was last rendered at
on
(method) Inky.Element:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element
Execute callback when Scene event is raised from the parent Scene \
See: Inky.Scene.raise
onDisable
(method) Inky.Element:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element isn't rendered, when it was rendered last frame
onEnable
(method) Inky.Element:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element is rendered, when it wasn't rendered last frame
onPointer
(method) Inky.Element:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event is raised from an overlapping/capturing Pointer \
See: * Inky.Pointer.raise * Inky.Pointer.captureElement
onPointerEnter
(method) Inky.Element:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer enters the bounding box of the Element
onPointerExit
(method) Inky.Element:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer exits the bounding box of the Element
onPointerInHierarchy
(method) Inky.Element:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event was accepted by a child Element \
See: * Inky.Pointer.raise * Inky.Element.onPointer
props
Inky.Props|{ [string]: any }
render
(method) Inky.Element:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element
Render the Element, setting up all the hooks and drawing the Element
Note: The parent Scene's frame must have been begun to be able to render\
useEffect
(method) Inky.Element:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element
Execute a side effect when any specified Element's prop changes
Note: The effect is ran right before a render
useOverlapCheck
(method) Inky.Element:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element
Use an additional check to determine if a Pointer is overlapping an Element
Note: Check is performed after a bounding box check
Inky.Element.Draw
Inky.Element.Effect
Inky.Element.Initializer
Inky.Element.Internal
_depth
number
_draw
fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number)
_effects
{ [string]: fun(element: Inky.Element):nil[] }
_element
Inky.Element
_h
number
_initializer
fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number)
_isInitialized
boolean
_onCallbacks
{ [string]: fun(element: Inky.Element, ...any):nil[] }
_onDisableCallbacks
fun(element: Inky.Element):nil[]
_onEnableCallbacks
fun(element: Inky.Element):nil[]
_onPointerCallbacks
{ [string]: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil[] }
_onPointerEnterCallbacks
fun(element: Inky.Element, pointer: Inky.Pointer):nil[]
_onPointerExitCallbacks
fun(element: Inky.Element, pointer: Inky.Pointer):nil[]
_onPointerInHierarchyCallbacks
{ [string]: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil[] }
_overlapCheck
fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean
_props
Inky.Props|{ [string]: any }
_scene
Inky.Scene
_w
number
_x
number
_y
number
constructor
(method) Inky.Element.Internal:constructor(element: Inky.Element, scene: Inky.Scene, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
doesPointPassBoundingboxCheck
(method) Inky.Element.Internal:doesPointPassBoundingboxCheck(px: number, py: number)
-> boolean
doesPointPassOverlapCheck
(method) Inky.Element.Internal:doesPointPassOverlapCheck(px: number, py: number)
-> boolean
doesViewDiffer
(method) Inky.Element.Internal:doesViewDiffer(x: number, y: number, w: number, h: number)
-> boolean
getDepth
(method) Inky.Element.Internal:getDepth()
-> number
getProps
(method) Inky.Element.Internal:getProps()
-> Inky.Props|{ [string]: any }
getView
(method) Inky.Element.Internal:getView()
-> x: number
2. y: number
3. w: number
4. h: number
initialize
(method) Inky.Element.Internal:initialize()
isInitialized
(method) Inky.Element.Internal:isInitialized()
-> boolean
on
(method) Inky.Element.Internal:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element.Internal
onDisable
(method) Inky.Element.Internal:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element.Internal
onEnable
(method) Inky.Element.Internal:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element.Internal
onPointer
(method) Inky.Element.Internal:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element.Internal
onPointerEnter
(method) Inky.Element.Internal:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element.Internal
onPointerExit
(method) Inky.Element.Internal:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element.Internal
onPointerInHierarchy
(method) Inky.Element.Internal:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element.Internal
raiseDisable
(method) Inky.Element.Internal:raiseDisable()
-> accepted: boolean
raiseEnable
(method) Inky.Element.Internal:raiseEnable()
-> accepted: boolean
raiseOn
(method) Inky.Element.Internal:raiseOn(eventName: string, ...any)
-> accepted: boolean
raiseOnPointer
(method) Inky.Element.Internal:raiseOnPointer(eventName: string, pointer: Inky.Pointer, ...any)
-> accepted: boolean
2. consumed: boolean
raiseOnPointerInHierarchy
(method) Inky.Element.Internal:raiseOnPointerInHierarchy(eventName: string, pointer: Inky.Pointer, ...any)
-> accepted: boolean
raisePointerEnter
(method) Inky.Element.Internal:raisePointerEnter(pointer: Inky.Pointer)
-> accepted: boolean
raisePointerExit
(method) Inky.Element.Internal:raisePointerExit(pointer: Inky.Pointer)
-> accepted: boolean
render
(method) Inky.Element.Internal:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element.Internal
renderIntoScene
(method) Inky.Element.Internal:renderIntoScene(scene: Inky.Scene, x: number, y: number, w: number, h: number, depth: number)
setView
(method) Inky.Element.Internal:setView(x: number, y: number, w: number, h: number)
-> Inky.Element.Internal
useEffect
(method) Inky.Element.Internal:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element.Internal
useOverlapCheck
(method) Inky.Element.Internal:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element.Internal
Inky.Element.OnCallback
Inky.Element.OnDisableCallback
Inky.Element.OnEnableCallback
Inky.Element.OnPointerCallback
Inky.Element.OnPointerEnterCallback
Inky.Element.OnPointerExitCallback
Inky.Element.OnPointerInHierarchyCallback
Inky.Element.OverlapPredicate
Inky.Pointer
__getInternal
(method) Inky.Pointer:__getInternal()
-> Inky.Pointer.Internal
Get the internal representation of the Pointer
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Pointer.Internal
captureElement
(method) Inky.Pointer:captureElement(element: Inky.Element, shouldCapture?: boolean)
-> Inky.Pointer
Capture a Element, meaning all raised events will be able to be sent to it, even if it's not being hovered \
See: * Inky.Element.onPointer * Inky.Element.onPointerInHierarchy
constructor
(method) Inky.Pointer:constructor(scene: Inky.Scene)
doesCaptureElement
(method) Inky.Pointer:doesCaptureElement(element: Inky.Element)
-> boolean
Get if the Pointer captures the Element
doesOverlapAnyElement
(method) Inky.Pointer:doesOverlapAnyElement()
-> boolean
Get if the Pointer overlaps any Elements
doesOverlapElement
(method) Inky.Pointer:doesOverlapElement(element: Inky.Element)
-> boolean
Gets if the Pointer overlaps the Element
getMode
(method) Inky.Pointer:getMode()
-> Inky.PointerMode
Gets the mode of the Pointer
getPosition
(method) Inky.Pointer:getPosition()
-> x: number?
2. y: number?
Gets the position of the Pointer
getTarget
(method) Inky.Pointer:getTarget()
-> (Inky.Element)?
Gets the target of the Pointer
isActive
(method) Inky.Pointer:isActive()
-> boolean
Gets if the Pointer is active
raise
(method) Inky.Pointer:raise(eventName: string, ...any)
-> boolean
Raise a Pointer event, to be caught by Elements \
See: * Inky.Element.onPointer * Inky.Element.onPointerInHierarchy
setActive
(method) Inky.Pointer:setActive(active: boolean)
-> Inky.Pointer
Sets if the Pointer is active, to potentially enter or exit Elements \
See: * Inky.Element.OnPointerEnterCallback * Inky.Element.OnPointerExitCallback
setPosition
(method) Inky.Pointer:setPosition(x: number, y: number)
-> Inky.Pointer
Sets the position of the Pointer, to potentially enter or exit Elements \
See: * Inky.Element.OnPointerEnterCallback * Inky.Element.OnPointerExitCallback
setTarget
(method) Inky.Pointer:setTarget(target: Inky.Element)
-> Inky.Pointer
Sets the target of the Pointer, to potentially enter or exit Elements
A 'target' Pointer is useful for keyboard navigation, or invoking events on Elements programmatically \
See: * Inky.Element.OnPointerEnterCallback * Inky.Element.OnPointerExitCallback
Inky.Pointer.Internal
_active
boolean
_capturedElements
Inky.HashSet
_mode
Inky.PointerMode
_overlappingElements
Inky.HashSet
_pointer
(Inky.Pointer)?
_scene
(Inky.Scene)?
_target
(Inky.Element)?
_x
number?
_y
number?
captureElement
(method) Inky.Pointer.Internal:captureElement(element: Inky.Element, shouldCapture?: boolean)
-> Inky.Pointer.Internal
constructor
(method) Inky.Pointer.Internal:constructor(pointer: Inky.Pointer, scene: Inky.Scene)
doesCaptureElement
(method) Inky.Pointer.Internal:doesCaptureElement(element: Inky.Element)
-> boolean
doesOverlapAnyElement
(method) Inky.Pointer.Internal:doesOverlapAnyElement()
-> boolean
doesOverlapElement
(method) Inky.Pointer.Internal:doesOverlapElement(element: Inky.Element)
-> boolean
getMode
(method) Inky.Pointer.Internal:getMode()
-> Inky.PointerMode
getPosition
(method) Inky.Pointer.Internal:getPosition()
-> x: number?
2. y: number?
getTarget
(method) Inky.Pointer.Internal:getTarget()
-> (Inky.Element)?
isActive
(method) Inky.Pointer.Internal:isActive()
-> boolean
raise
(method) Inky.Pointer.Internal:raise(eventName: string, ...any)
-> boolean
setActive
(method) Inky.Pointer.Internal:setActive(active: boolean)
-> Inky.Pointer.Internal
setOverlappingElements
(method) Inky.Pointer.Internal:setOverlappingElements(overlappingElements?: Inky.HashSet)
setPosition
(method) Inky.Pointer.Internal:setPosition(x: number, y: number)
-> Inky.Pointer.Internal
setTarget
(method) Inky.Pointer.Internal:setTarget(target: Inky.Element)
-> Inky.Pointer.Internal
Inky.Props
_internal
Inky.Props.Internal
Inky.Props.Internal
changedValues
Inky.HashSet
constructor
(method) Inky.Props.Internal:constructor()
values
{ [string]: any }
Inky.Scene
__getInternal
(method) Inky.Scene:__getInternal()
-> Inky.Scene.Internal
Get the internal representation of the Scene
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Scene.Internal
beginFrame
(method) Inky.Scene:beginFrame()
-> Inky.Scene
Begin a frame to render Elements in
Note: A frame must have been begun before Elements can be drawn \
See: Inky.Element.render
constructor
(method) Inky.Scene:constructor(spatialHashSize?: integer)
didBeginFrame
(method) Inky.Scene:didBeginFrame()
-> boolean
Get if frame did begin
finishFrame
(method) Inky.Scene:finishFrame()
-> Inky.Scene
End a frame to render Elements in
A frame must have been finished before Elements can be acted on
raise
(method) Inky.Scene:raise(eventName: string, ...unknown)
-> Inky.Scene
Raise a Scene event, to be caught by Elements \
Inky.Scene.Internal
_beganFrame
boolean
_beginElement
(method) Inky.Scene.Internal:_beginElement(element: Inky.Element, x: any, y: any, w: any, h: any)
-> Inky.Scene.Internal
_elements
Inky.HashSet
_elementsChanged
boolean
_finishElement
(method) Inky.Scene.Internal:_finishElement(element: Inky.Element)
-> Inky.Scene.Internal
_parentStack
Inky.Element[]
_parents
{ [Inky.Element]: Inky.Element }
_pointers
Inky.HashSet
_resolvePointerOverlappingElements
(method) Inky.Scene.Internal:_resolvePointerOverlappingElements(pointer: Inky.Pointer)
-> Inky.Scene.Internal|nil
_scene
Inky.Scene
_spatialHash
Inky.SpatialHash
_suppliedElements
Inky.HashSet
addPointer
(method) Inky.Scene.Internal:addPointer(pointer: Inky.Pointer)
-> Inky.Scene.Internal
beginFrame
(method) Inky.Scene.Internal:beginFrame()
-> Inky.Scene.Internal
constructor
(method) Inky.Scene.Internal:constructor(scene: Inky.Scene, spatialHashSize?: integer)
didBeginFrame
(method) Inky.Scene.Internal:didBeginFrame()
-> boolean
Get if frame did begin
finishFrame
(method) Inky.Scene.Internal:finishFrame()
-> Inky.Scene.Internal
getElementParent
(method) Inky.Scene.Internal:getElementParent(element: Inky.Element)
-> (Inky.Element)?
onPointerActiveChanged
(method) Inky.Scene.Internal:onPointerActiveChanged(pointer: Inky.Pointer)
onPointerPositionChanged
(method) Inky.Scene.Internal:onPointerPositionChanged(pointer: Inky.Pointer)
onPointerTargetChanged
(method) Inky.Scene.Internal:onPointerTargetChanged(pointer: Inky.Pointer)
raise
(method) Inky.Scene.Internal:raise(eventName: string, ...unknown)
Raise an event
render
(method) Inky.Scene.Internal:render(element: Inky.Element, x: number, y: number, w: number, h: number, depth?: number)
Inky.SpatialHash
_cells
Inky.HashSet[]
_elements
{ [Inky.Scene]: Inky.HashSet[] }
_hash
(method) Inky.SpatialHash:_hash(x: integer, y: integer)
-> hash: number
_inverseHash
(method) Inky.SpatialHash:_inverseHash(hash: integer)
-> x: integer
2. y: integer
_size
integer
_toCell
(method) Inky.SpatialHash:_toCell(v: integer)
-> cellV: integer
_toCellBounds
(method) Inky.SpatialHash:_toCellBounds(x: number, y: number, w: number, h: number)
-> topLeftCellX: integer
2. topLeftCellY: integer
3. bottomRightCellX: integer
4. bottomRightCellY: integer
add
(method) Inky.SpatialHash:add(element: Inky.Element)
-> Inky.SpatialHash
constructor
(method) Inky.SpatialHash:constructor(size: any)
getElementsAtPoint
(method) Inky.SpatialHash:getElementsAtPoint(x: integer, y: integer)
-> Inky.HashSet
move
(method) Inky.SpatialHash:move(element: Inky.Element)
-> Inky.SpatialHash
remove
(method) Inky.SpatialHash:remove(element: Inky.Element)
-> Inky.SpatialHash
Inky.SpatialHash.Cell
Keybinding
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Keybinding:__new(schema: table)
Constructor for the Keybinding class. Initializes the keymap and modes with a predefined schema and defaults.
@param schema — A list of predefined keybindings with their schema and defaults.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
clear
(method) Keybinding:clear(mode: string|nil)
Resets keybindings for a specific mode or all modes to their defaults.
@param mode — The mode to reset. If nil, resets all modes.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
keymap
table
Stores modifications
keypressed
(method) Keybinding:keypressed(key: string, mode: string|nil)
-> The: string|nil
Handles key press events and retrieves the associated action if a binding exists. Falls back to the schema if no modification is found.
@param key — The key that was pressed.
@param mode — The mode to use for the keybinding.
@return The — action associated with the key, or nil if no binding exists.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
schema
table
Holds the schema for all modes, including "default"
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
set
(method) Keybinding:set(key: string, action: string, mode: string|nil)
Sets or updates a keybinding, validating it exists in the schema.
@param key — The key to bind.
@param action — The new action to associate with the key.
@param mode — An optional mode for the binding (defaults to "default").
stripName
boolean
Level
RNG
RNG
The level's local random number generator, use this for randomness within the level like attack rolls.
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Level:__new(map: Map, actors: [Actor], systems: [System], scheduler: any, seed: any)
Constructor for the Level class.
@param map — The map to use for the level.
@param actors — A list of actors to
_serializationBlacklist
table
actorStorage
ActorStorage
The main actor storage containing all of the level's actors.
addActor
(method) Level:addActor(actor: Actor)
Adds an actor to the level. Handles updating the component cache and inserting the actor into the sparse map. It will also add the actor to the scheduler if it has a controller.
@param actor — The actor to add.
addComponent
(method) Level:addComponent(actor: Actor, component: Component)
Adds a component to an actor. It handles updating the component cache and the opacity cache. You can do this manually, but it's easier to use this function.
@param actor — The actor to add the component to.
@param component — The component to add.
addSystem
(method) Level:addSystem(system: System)
Attaches a system to the level. This function will error if the system doesn't have a name or if a system with the same name already exists, or if the system has a requirement that hasn't been attached yet.
@param system — The system to add.
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
computeFOV
(method) Level:computeFOV(origin: any, maxDepth: any, callback: any)
debug
boolean
debugYield
(method) Level:debugYield(stringMessage: any)
decision
ActionDecision
Used during deserialization to resume.
deserialize
function Object.deserialize(data: any)
-> unknown
eachActor
(method) Level:eachActor(...Component)
-> An: function
This method returns an iterator that will return all actors in the level that have the given components. If no components are given it iterate over all actors. A thin wrapper over the inner ActorStorage.
@param ... — The components to filter by.
@return An — iterator that returns the next actor that matches the given components.
eachActorAt
(method) Level:eachActorAt(x: number, y: number)
-> iter: function
Returns an iterator that will return all actors at the given position.
@param x — The x component of the position to check.
@param y — The y component of the position to check.
@return iter — An iterator that returns the next actor at the given position.
eachCell
(method) Level:eachCell()
-> fun():number, number, <T>
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
findPath
(method) Level:findPath(startPos: Vector2, goalPos: Vector2, minDistance: any, mask: any)
-> Path|nil
Finds a path from startpos to endpos
getAOE
(method) Level:getAOE(type: "box"|"fov", position: Vector2, range: number)
-> actors: table?
2. fov: table?
Returns a list of all actors that are within the given range of the given position. The type parameter determines the type of range to use. Currently only "fov" and "box" are supported. The fov type uses a field of view algorithm to determine what actors are visible from the given position. The box type uses a simple box around the given position.
@param type — The type of range to use.
@param position — The position to check from.
@param range — The range to check.
@return actors
@return fov — A list of actors within the given range.
type:
| "box"
| "fov"
getActorByType
(method) Level:getActorByType(prototype: Actor)
-> The: Actor|nil
Returns the first actor that extends the given prototype, or nil if no actor is found. Useful for one offs like stairs in some games.
@param prototype — The prototype to check for.
@return The — first actor that extends the given prototype, or nil if no actor is found.
getActorController
(method) Level:getActorController(actor: Actor)
-> controller: ControllerComponent
Gets the actor's controller. This is a utility function that checks the actor's conditions for an override controller and returns it if it exists. Otherwise it returns the actor's normal controller.
@param actor — The actor to get the controller for.
@return controller — The actor's controller.
getActorsAt
(method) Level:getActorsAt(x: number, y: number)
-> A: table
Returns a list of all actors at the given position. A thin wrapper over the inner ActorStorage.
@param x — The x component of the position to check.
@param y — The y component of the position to check.
@return A — list of all actors at the given position.
getCell
(method) Level:getCell(x: number, y: number)
-> The: Cell
Gets the cell at the given position.
@param x — The x component of the position to get.
@param y — The y component of the position to get.
@return The — cell at the given position.
getCellOpaque
(method) Level:getCellOpaque(x: number, y: number)
-> True: boolean
Returns true if the cell at the given position is opaque, false otherwise.
@param x — The x component of the position to check.
@param y — The y component of the position to check.
@return True — if the cell is opaque, false otherwise.
getCellPassable
(method) Level:getCellPassable(x: number, y: number, mask: integer)
-> True: boolean
Returns true if the cell at the given position is passable, false otherwise. Considers actors in the sparse map as well as the cell's passable property.
@param x — The x component of the position to check.
@param y — The y component of the position to check.
@return True — if the cell is passable, false otherwise.
getID
(method) Level:getID(actor: Actor)
-> The: integer?
Retrieves the unique ID associated with the specified actor. Note: IDs are unique to actors within the Level but may be reused when indices are freed.
@param actor — The actor whose ID is to be retrieved.
@return The — unique ID of the actor, or nil if the actor is not found.
getOpacityCache
(method) Level:getOpacityCache()
-> map: BooleanBuffer
Returns the opacity cache for the level. This generally shouldn't be used outside of systems that need to know about opacity.
@return map — The opacity cache for the level.
getSystem
(method) Level:getSystem(className: string)
-> system: System?
Gets a system by name.
@param className — The name of the system to get.
@return system — The system with the given name.
hasActor
(method) Level:hasActor(actor: Actor)
-> hasActor: boolean
Returns true if the level contains the given actor, false otherwise. A thin wrapper over the inner ActorStorage.
@param actor — The actor to check for.
@return hasActor — True if the level contains the given actor, false otherwise.
inBounds
(method) Level:inBounds(x: integer, y: integer)
-> boolean
Is there a cell at this x, y? Part of the interface with MapBuilder
@param x — The x component to check if in bounds.
initialize
(method) Level:initialize(actors: [Actor], systems: [System])
initializeOpacityCache
(method) Level:initializeOpacityCache()
Initialize the opacity cache. This should be called after the level is created and before the game loop starts. It will initialize the opacity cache with the cell opacity cache. This is handled automatically by the Level class.
initializePassabilityCache
(method) Level:initializePassabilityCache()
Initialize the passable cache. This should be called after the level is created and before the game loop starts. It will initialize the passable cache with the cell passable cache. This is handled automatically by the Level class.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
map
Map
The level's map.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
moveActor
(method) Level:moveActor(actor: Actor, pos: Vector2, skipSparseMap: boolean)
Moves an actor to the given position. This function doesn't do any checking for overlaps or collisions. It's used by the moveActorChecked function, you should generally not invoke this yourself using moveActorChecked instead.
@param actor — The actor to move.
@param pos — The position to move the actor to.
@param skipSparseMap — If true the sparse map won't be updated.
onDeserialize
(method) Level:onDeserialize()
opacityCache
BooleanBuffer
A cache of cell opacity || actor opacity for each cell. Used to speed up fov/lighting calculations.
passableCache
BitmaskBuffer
A cache of cell passability || actor passability for each cell. Used to speed up pathfinding.
performAction
(method) Level:performAction(action: Action, silent?: boolean)
Executes an Action, updating the level's state and triggering any events through the systems attached to the Actor or Level respectively. It also updates the 'Scheduler' if the action isn't a reaction or free action. Lastly, it calls the 'onAction' method on the 'Cell' that the 'Actor' is standing on.
@param action — The action to perform.
@param silent — If true this action emits no events.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) Level:removeActor(actor: Actor)
Removes an actor from the level. Handles updating the component cache and removing the actor from the sparse map. It will also remove the actor from the scheduler if it has a controller.
@param actor — The actor to remove.
removeComponent
(method) Level:removeComponent(actor: Actor, component: Component)
Removes a component from an actor. It handles updating the component cache and the opacity cache.
@param actor — The actor to remove the component from.
@param component — The component to remove.
run
(method) Level:run()
Initializes the level, Update is the main game loop for a level. It's a coroutine that yields back to the main thread when it needs to wait for input from the player. This function is the heart of the game loop.
scheduler
Scheduler
The main scheduler driving the loop of the game.
serializationBlacklist
table
serialize
function Object.serialize(object: any)
-> table
setCell
(method) Level:setCell(x: number, y: number, cell: Cell)
Sets the cell at the given position to the given cell.
@param x — The x component of the position to set.
@param y — The y component of the position to set.
@param cell — The cell to set.
sparseMapCallback
(method) Level:sparseMapCallback()
-> function
step
(method) Level:step()
stripName
boolean
systemManager
SystemManager
A table containing all of the systems active in the level, set in the constructor.
trigger
(method) Level:trigger(eventName: any, ...any)
updateCaches
(method) Level:updateCaches(x: any, y: any)
updateOpacityCache
(method) Level:updateOpacityCache(x: number, y: number)
Updates the opacity cache at the given position. This should be called whenever an actor moves or a cell's opacity changes. This is handled automatically by the Level class.
@param x — The x component of the position to update.
@param y — The y component of the position to update.
updatePassabilityCache
(method) Level:updatePassabilityCache(x: number, y: number)
Updates the passability cache at the given position. This should be called whenever an actor moves or a cell's passability changes. This is handled automatically by the Level class.
@param x — The x component of the position to update.
@param y — The y component of the position to update.
yield
(method) Level:yield(message: Message)
-> Decision|nil
Yields to the main 'thread', a coroutine in this case. This is called in run, and a few systems. Any time you want the interface to update you should call this. Avoid calling coroutine.yield directly, as this function will call the onYield method on all systems.
LevelState
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) LevelState:__new(level: Level, display: Display, actionHandlers: table<fun():fun()>)
Constructs a new LevelState. Sets up the game loop, initializes decision handlers, and binds custom callbacks for drawing.
@param level — The level object to be managed by this state.
@param display — The display object for rendering the level.
@param actionHandlers — A table of callback generators for handling actions.
_serializationBlacklist
table
actionHandlers
table<fun():fun()>
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
decision
Decision
The current decision being processed, if any.
deserialize
function Object.deserialize(data: any)
-> unknown
display
Display
The display object used for rendering.
draw
(method) LevelState:draw()
Draws the current state of the level, including the perspective of relevant actors.
drawBeforeCells
(method) LevelState:drawBeforeCells(display: Display)
Draws content before rendering cells. Override in subclasses for custom behavior.
@param display — The display object used for drawing.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
geometer
EditorState
An editor state for debugging or managing geometry.
getManager
(method) GameState:getManager()
-> GameStateManager
handleActionMessage
(method) LevelState:handleActionMessage(message: ActionMessage)
Handles an action message by determining visibility and setting display overrides.
@param message — The action message to handle.
handleMessage
(method) LevelState:handleMessage(message: any)
Handles incoming messages from the coroutine. Processes decisions, action messages, and debug messages as appropriate.
@param message — The message to handle.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
keypressed
(method) GameState:keypressed(key: any, scancode: any)
Called on each keypress.
level
Level
The level object representing the game environment.
load
(method) GameState:load()
Called when the gamestate is started.
manager
GameStateManager
message
ActionMessage
The most recent action message.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mousepressed
(method) GameState:mousepressed(x: any, y: any, button: any, istouch: any, presses: any)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
shouldAdvance
(method) LevelState:shouldAdvance()
-> shouldAdvance: boolean|nil
Determines if the coroutine should proceed to the next step.
@return shouldAdvance — True if the coroutine should advance; false otherwise.
stripName
boolean
time
integer
unload
(method) GameState:unload()
Calls when the gamestate is stopped.
update
(method) LevelState:update(dt: number)
Updates the state of the level. Advances the coroutine and processes decisions or messages if necessary.
@param dt — The time delta since the last update.
updateCoroutine
thread
updateDecision
(method) LevelState:updateDecision(dt: number, actor: Actor, decision: ActionDecision)
This method is invoked each update when a decision exists and its response is not yet valid.. Override this method in subclasses to implement custom decision-handling logic.
@param dt — The time delta since the last update.
@param actor — The actor responsible for making the decision.
@param decision — The decision being updated.
wheelmoved
(method) GameState:wheelmoved(dx: any, dy: any)
Called when the mouse wheel is moved.
LineModification
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) LineModification:__new(placeable: Actor|Cell, topleft: Vector2, bottomright: Vector2)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
bottomright
Vector2
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
execute
(method) LineModification:execute(attachable: SpectrumAttachable)
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
placeActor
(method) Modification:placeActor(attachable: SpectrumAttachable, x: integer, y: integer, actorPrototype: Actor)
placeCell
(method) Modification:placeCell(attachable: SpectrumAttachable, x: integer, y: integer, cellPrototype: Cell|nil)
placeable
Actor|Cell
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
placed
Actor|Cell[]|nil
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) Modification:removeActor(level: any, actor: any)
removed
table
replaced
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
topleft
Vector2
undo
(method) Modification:undo(attachable: SpectrumAttachable)
Undoes the modification. Override this method in subclasses to define how the modification is undone.
LineTool
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) LineTool:__new()
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) LineTool:draw(editor: Editor, display: Display)
drawCell
(method) Tool:drawCell(display: Display, drawable: DrawableComponent, x: number, y: number)
Draws a cell at the given coordinates.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getDrawable
(method) Tool:getDrawable(placeable: Actor|Cell)
-> DrawableComponent
Returns the DrawableComponent from placeable
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mouseclicked
(method) LineTool:mouseclicked(editor: Editor, attachable: SpectrumAttachable, x: integer, y: integer)
@param x — The cell coordinate clicked.
@param y — The cell coordinate clicked.
mousereleased
(method) LineTool:mousereleased(editor: Editor)
origin
Vector2
overrideCellDraw
(method) Tool:overrideCellDraw(editor: Editor, level: Level, cellx: integer, celly: integer)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
to
Vector2
update
(method) LineTool:update(dt: number, editor: Editor)
LuaLS
Map
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Map:__new(w: number, h: number, initialValue: Cell)
The constructor for the 'Map' class. Initializes the map with the specified dimensions and initial value, and sets up the opacity caches.
@param w — The width of the map.
@param h — The height of the map.
@param initialValue — The initial value to fill the map with.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
data
any[]
The data stored in the grid.
deserialize
function Object.deserialize(data: any)
-> unknown
each
(method) Grid:each()
-> An: fun():number, number, <T>
Iterates over each cell in the grid, yielding x, y, and the value.
@return An — iterator returning x, y, and value for each cell.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
fill
(method) Grid:fill(value: <T>)
Fills the entire grid with the specified value.
@param value — The value to fill the grid with.
fromData
(method) Grid:fromData(w: integer, h: integer, data: <T>[])
-> The: Grid<<T>>
Initializes the grid with the specified dimensions and data.
@param w — The width of the grid.
@param h — The height of the grid.
@param data — The data to fill the grid with.
@return The — initialized grid.
get
(method) Map:get(x: number, y: number)
-> cell: Cell
Gets the cell at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@return cell — The cell at the specified coordinates.
getCellOpaque
(method) Map:getCellOpaque(x: number, y: number)
-> True: boolean
Returns true if the cell at the specified coordinates is opaque, false otherwise.
@param x — The x-coordinate.
@param y — The y-coordinate.
@return True — if the cell is opaque, false otherwise.
getCellPassable
(method) Map:getCellPassable(x: number, y: number, mask: any)
-> True: boolean
Returns true if the cell at the specified coordinates is passable, false otherwise.
@param x — The x-coordinate.
@param y — The y-coordinate.
@return True — if the cell is passable, false otherwise.
getIndex
(method) Grid:getIndex(x: integer, y: integer)
-> The: number?
Gets the index in the data array for the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@return The — index in the data array, or nil if out of bounds.
h
integer
The height of the grid.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
onDeserialize
(method) Map:onDeserialize()
opacityCache
BooleanBuffer
Caches the opaciy of the cell + actors in each tile for faster fov calculation.
passableCache
BitmaskBuffer
A class representing a 2D bitmask buffer using 16-bit integers.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table
serialize
function Object.serialize(object: any)
-> table
set
(method) Map:set(x: number, y: number, cell: Cell)
Sets the cell at the specified coordinates to the given value.
@param x — The x-coordinate.
@param y — The y-coordinate.
@param cell — The cell to set.
stripName
boolean
updateCaches
(method) Map:updateCaches(x: number, y: number)
Updates the opacity cache at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
w
integer
The width of the grid.
MapBuilder
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) MapBuilder:__new(initialValue: Cell)
The constructor for the 'MapBuilder' class. Initializes the map with an empty data table and actors list.
@param initialValue — The initial value to fill the map with.
_serializationBlacklist
table
actors
ActorStorage
A list of actors present in the map.
addActor
(method) MapBuilder:addActor(actor: table, x?: number, y?: number)
Adds an actor to the map at the specified coordinates.
@param actor — The actor to add.
@param x — The x-coordinate.
@param y — The y-coordinate.
addPadding
(method) MapBuilder:addPadding(width: number, cell: Cell)
Adds padding around the map with a specified width and cell value.
@param width — The width of the padding to add.
@param cell — The cell value to use for padding.
adopt
(method) Object:adopt(o: any)
-> unknown
blit
(method) MapBuilder:blit(source: MapBuilder, destX: number, destY: number, maskFn: fun(x: integer, y: integer, source: Cell, dest: Cell)|nil)
Blits the source MapBuilder onto this MapBuilder at the specified coordinates.
@param source — The source MapBuilder to copy from.
@param destX — The x-coordinate of the top-left corner in the destination MapBuilder.
@param destY — The y-coordinate of the top-left corner in the destination MapBuilder.
@param maskFn — A callback function for masking. Should return true if the cell should be copied, false otherwise.
build
(method) MapBuilder:build()
-> Map
2. actors: table
Builds the map and returns the map and list of actors. Converts the sparse grid to a contiguous grid.
@return actors — map and the list of actors.
className
string
A unique name for this class. By convention this should match the annotation name you use.
clear
(method) SparseGrid:clear()
Clears all values in the sparse grid.
data
table
debug
boolean
deserialize
function Object.deserialize(data: any)
-> unknown
drawEllipse
(method) MapBuilder:drawEllipse(cx: number, cy: number, rx: number, ry: number, cell: Cell)
Draws an ellipse on the map.
@param cx — The x-coordinate of the center.
@param cy — The y-coordinate of the center.
@param rx — The radius along the x-axis.
@param ry — The radius along the y-axis.
@param cell — The cell to fill the ellipse with.
drawLine
(method) MapBuilder:drawLine(x1: number, y1: number, x2: number, y2: number, cell: Cell)
Draws a line on the map using Bresenham's line algorithm.
@param x1 — The x-coordinate of the starting point.
@param y1 — The y-coordinate of the starting point.
@param x2 — The x-coordinate of the ending point.
@param y2 — The y-coordinate of the ending point.
@param cell — The cell to draw the line with.
drawRectangle
(method) MapBuilder:drawRectangle(x1: number, y1: number, x2: number, y2: number, cell: Cell)
Draws a rectangle on the map.
@param x1 — The x-coordinate of the top-left corner.
@param y1 — The y-coordinate of the top-left corner.
@param x2 — The x-coordinate of the bottom-right corner.
@param y2 — The y-coordinate of the bottom-right corner.
@param cell — The cell to fill the rectangle with.
each
(method) SparseGrid:each()
-> iter: fun(x: integer, y: integer, V: any)
Iterator function for the SparseGrid. Iterates over all entries in the sparse grid, returning the coordinates and value for each entry.
@return iter — An iterator function that returns the x-coordinate, y-coordinate, and value for each entry.
eachActor
(method) MapBuilder:eachActor(...any)
-> function
eachActorAt
(method) MapBuilder:eachActorAt(x: any, y: any)
-> function
eachCell
(method) MapBuilder:eachCell()
-> fun(x: integer, y: integer, V: any)
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
get
(method) MapBuilder:get(x: number, y: number)
-> value: any
Gets the value at the specified coordinates, or the initialValue if not set.
@param x — The x-coordinate.
@param y — The y-coordinate.
@return value — The value at the specified coordinates, or the initialValue if not set.
getActorsAt
fun(self: any, x: integer, y: integer)
getCell
(method) MapBuilder:getCell(x: any, y: any)
-> unknown
inBounds
(method) MapBuilder:inBounds(x: any, y: any)
-> boolean
initialValue
Cell
The initial value to fill the map with.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) MapBuilder:removeActor(actor: table)
Removes an actor from the map.
@param actor — The actor to remove.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
set
(method) MapBuilder:set(x: number, y: number, value: any)
Sets the value at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@param value — The value to set.
setCell
(method) MapBuilder:setCell(x: any, y: any, value: any)
Mirror set.
stripName
boolean
MapGeneratorState
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) MapGeneratorState:__new(generator: fun(mapbuilder: MapBuilder):fun())
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) EditorState:draw()
editor
Editor
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
generator
thread
getManager
(method) GameState:getManager()
-> GameStateManager
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
keypressed
(method) EditorState:keypressed(key: any, scancode: any)
load
(method) EditorState:load()
manager
GameStateManager
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mousemoved
(method) EditorState:mousemoved(x: any, y: any, dx: any, dy: any, istouch: any)
mousepressed
(method) EditorState:mousepressed(x: any, y: any, button: any)
mousereleased
(method) EditorState:mousereleased(x: any, y: any, button: any)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
textinput
(method) EditorState:textinput(text: any)
unload
(method) GameState:unload()
Calls when the gamestate is stopped.
update
(method) MapGeneratorState:update(dt: any)
wheelmoved
(method) EditorState:wheelmoved(dx: any, dy: any)
Message
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
Modification
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
execute
(method) Modification:execute(attachable: SpectrumAttachable, editor: Editor)
Executes the modification. Override this method in subclasses to define the behavior of the modification.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
placeActor
(method) Modification:placeActor(attachable: SpectrumAttachable, x: integer, y: integer, actorPrototype: Actor)
placeCell
(method) Modification:placeCell(attachable: SpectrumAttachable, x: integer, y: integer, cellPrototype: Cell|nil)
placed
table
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) Modification:removeActor(level: any, actor: any)
removed
table
replaced
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
undo
(method) Modification:undo(attachable: SpectrumAttachable)
Undoes the modification. Override this method in subclasses to define how the modification is undone.
Neighborhood
Object
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
OpaqueComponent
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
checkRequirements
(method) Component:checkRequirements(actor: Actor)
-> meetsRequirements: boolean
Checks whether an actor has the required components to attach this component.
@param actor — The actor to check the requirements against.
@return meetsRequirements — the actor meets all requirements, false otherwise.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
initialize
(method) Component:initialize(owner: Actor)
Called after the actor is loaded and ready, this is where the component should do any initialization requiring the actor. This would include stuff like attaching systems, etc.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
owner
Actor
The Actor this component is composing. This is set by Actor when a component is added or removed.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
requirements
table
A list of component prototypes the actor must first have, before this can be applied.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
PasteModification
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) PasteModification:__new(cells: SparseGrid, actors: SparseMap, topLeft: Vector2)
_serializationBlacklist
table
actors
SparseMap
A sparse grid of buckets that objects can be placed into. Used for tracking actors by x,y position in Level.
adopt
(method) Object:adopt(o: any)
-> unknown
cells
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
execute
(method) PasteModification:execute(attachable: SpectrumAttachable, editor: Editor)
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
placeActor
(method) Modification:placeActor(attachable: SpectrumAttachable, x: integer, y: integer, actorPrototype: Actor)
placeCell
(method) Modification:placeCell(attachable: SpectrumAttachable, x: integer, y: integer, cellPrototype: Cell|nil)
placed
table
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) Modification:removeActor(level: any, actor: any)
removed
table
replaced
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
topLeft
Vector2
undo
(method) Modification:undo(attachable: SpectrumAttachable)
Undoes the modification. Override this method in subclasses to define how the modification is undone.
Path
__call
function
__index
Path
A class to represent the A* path and its cost
__new
(method) Path:__new(path: Vector2[], costIndex: integer[])
-> Path
Constructor for the Path class
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
cost
number
The total cost to traverse the path
costIndex
integer[]
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getPath
(method) Path:getPath()
-> Vector2[]
Get the path as a table of nodes
getTotalCost
(method) Path:getTotalCost()
-> number
Get the total cost of the path
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
length
(method) Path:length()
-> integer
Get the length of the path (number of nodes)
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
path
Vector2[]
The path as an ordered list of Vector2 nodes
pop
(method) Path:pop()
-> Vector2|nil
Pop the first node from the path
@return — The removed node, or nil if the path is empty
popBack
(method) Path:popBack()
-> unknown|nil
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
totalCostAt
(method) Path:totalCostAt(index: integer)
-> number
Get the total cost at a specific index in the path
@param index — The index in the path
@return — The total cost up to the specified index
trim
(method) Path:trim(maxCost: number)
-> Path
Trim the path to a given total cost
@param maxCost — The maximum allowable cost for the trimmed path
@return — A new Path object with the trimmed path
PenModification
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) PenModification:__new(placeable: Actor|Cell, locations: SparseGrid)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
execute
(method) PenModification:execute(attachable: SpectrumAttachable)
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
locations
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
placeActor
(method) Modification:placeActor(attachable: SpectrumAttachable, x: integer, y: integer, actorPrototype: Actor)
placeCell
(method) Modification:placeCell(attachable: SpectrumAttachable, x: integer, y: integer, cellPrototype: Cell|nil)
placeable
Actor|Cell
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
placed
Actor|Cell[]|nil
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) Modification:removeActor(level: any, actor: any)
removed
table
replaced
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
undo
(method) Modification:undo(attachable: SpectrumAttachable)
Undoes the modification. Override this method in subclasses to define how the modification is undone.
PenTool
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
dragging
boolean
draw
(method) PenTool:draw(editor: Editor, display: Display)
drawCell
(method) Tool:drawCell(display: Display, drawable: DrawableComponent, x: number, y: number)
Draws a cell at the given coordinates.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getDrawable
(method) Tool:getDrawable(placeable: Actor|Cell)
-> DrawableComponent
Returns the DrawableComponent from placeable
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
locations
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mouseclicked
(method) PenTool:mouseclicked(editor: Editor, level: any, x: number, y: number)
mousereleased
(method) PenTool:mousereleased(editor: Editor, level: any, x: number, y: number)
overrideCellDraw
(method) Tool:overrideCellDraw(editor: Editor, level: Level, cellx: integer, celly: integer)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
update
(method) PenTool:update(dt: number, editor: Editor)
Placeable
PlayerControllerComponent
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
act
(method) PlayerControllerComponent:act(level: Level, actor: Actor)
-> Action|nil
adopt
(method) Object:adopt(o: any)
-> unknown
blackboard
table|nil
checkRequirements
(method) Component:checkRequirements(actor: Actor)
-> meetsRequirements: boolean
Checks whether an actor has the required components to attach this component.
@param actor — The actor to check the requirements against.
@return meetsRequirements — the actor meets all requirements, false otherwise.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
initialize
(method) Component:initialize(owner: Actor)
Called after the actor is loaded and ready, this is where the component should do any initialization requiring the actor. This would include stuff like attaching systems, etc.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
owner
Actor
The Actor this component is composing. This is set by Actor when a component is added or removed.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
requirements
table
A list of component prototypes the actor must first have, before this can be applied.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
PrefabEditorState
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) PrefabEditorState:__new(mb: SpectrumAttachable)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) EditorState:draw()
editor
Editor
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getManager
(method) GameState:getManager()
-> GameStateManager
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
keypressed
(method) EditorState:keypressed(key: any, scancode: any)
load
(method) EditorState:load()
manager
GameStateManager
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mousemoved
(method) EditorState:mousemoved(x: any, y: any, dx: any, dy: any, istouch: any)
mousepressed
(method) EditorState:mousepressed(x: any, y: any, button: any)
mousereleased
(method) EditorState:mousereleased(x: any, y: any, button: any)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
textinput
(method) EditorState:textinput(text: any)
unload
(method) GameState:unload()
Calls when the gamestate is stopped.
update
(method) PrefabEditorState:update(dt: any)
wheelmoved
(method) EditorState:wheelmoved(dx: any, dy: any)
PriorityQueue
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) PriorityQueue:__new()
_bubbleDown
(method) PriorityQueue:_bubbleDown(i: integer)
Bubble down the element at index i to its proper place in the heap
_bubbleUp
(method) PriorityQueue:_bubbleUp(i: integer)
Bubble up the element at index i to its proper place in the heap
_heap
table
_serializationBlacklist
table
_swap
(method) PriorityQueue:_swap(i: integer, j: integer)
Swap elements at indices i and j in the heap
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
isEmpty
(method) PriorityQueue:isEmpty()
-> boolean
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
pop
(method) PriorityQueue:pop()
-> <T>|nil
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
push
(method) PriorityQueue:push(data: any, priority: integer)
Push a new element to the PriorityQueue.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
size
(method) PriorityQueue:size()
-> integer
stripName
boolean
Proto
Quadrant
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Quadrant:__new(cardinal: any, origin: any)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
cardinal
any
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
ox
unknown
oy
unknown
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
transform
(method) Quadrant:transform(row: any, col: any)
-> unknown
2. unknown
Queue
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Queue:__new()
Initializes a new Queue instance.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
clear
(method) Queue:clear()
Removes all elements from the queue.
contains
(method) Queue:contains(value: any)
-> True: boolean
Checks if the queue contains a specific value.
@param value — The value to check for.
@return True — if the value is in the queue, false otherwise.
deserialize
function Object.deserialize(data: any)
-> unknown
empty
(method) Queue:empty()
-> True: boolean
Checks if the queue is empty.
@return True — if the queue is empty, false otherwise.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
first
integer
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
last
integer
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
peek
(method) Queue:peek()
-> The: any
Returns the element at the start of the queue without removing it.
@return The — value at the start of the queue.
pop
(method) Queue:pop()
-> The: any
Removes and returns the element from the start of the queue.
@return The — value at the start of the queue.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
push
(method) Queue:push(value: any)
Adds an element to the end of the queue.
@param value — The value to be added to the queue.
queue
table
remove
(method) Queue:remove(value: any)
-> True: boolean
Removes the first occurrence of the specified value from the queue.
@param value — The value to be removed from the queue.
@return True — if the value was removed, false otherwise.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
size
(method) Queue:size()
-> The: number
Returns the number of elements in the queue.
@return The — size of the queue.
stripName
boolean
RNG
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) RNG:__new(seed: any)
Initializes a new RNG instance.
@param seed — The seed for the RNG (optional).
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
carrier
integer
className
string
A unique name for this class. By convention this should match the annotation name you use.
clone
(method) RNG:clone()
-> The: RNG
Clones the RNG.
@return The — cloned RNG.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getNormal
(method) RNG:getNormal(mean: number, stddev: number)
-> normal: number
Gets a normally distributed random number with the given mean and standard deviation.
@param mean — The mean (optional, default is 0).
@param stddev — The standard deviation (optional, default is 1).
@return normal — A normally distributed random number.
getPercentage
(method) RNG:getPercentage()
-> percentage: number
Gets a random percentage between 1 and 100.
@return percentage — A random percentage.
getSeed
(method) RNG:getSeed()
-> seed: any
Gets the current seed.
@return seed — The current seed.
getState
(method) RNG:getState()
-> The: table
Gets the current state of the RNG.
@return The — current state.
getUniform
(method) RNG:getUniform()
-> uniform: number
Gets a uniform random number between 0 and 1.
@return uniform — A uniform random number.
getUniformInt
(method) RNG:getUniformInt(lowerBound: number, upperBound: number)
-> uniformInteger: number
Gets a uniform random integer between lowerBound and upperBound.
@param lowerBound — The lower bound.
@param upperBound — The upper bound.
@return uniformInteger — A uniform random integer.
getWeightedValue
(method) RNG:getWeightedValue(tbl: table<<K>, <V>>)
-> value: <V>
Gets a random value from a weighted table.
@param tbl — The weighted table.
@return value — The selected value.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
random
(method) RNG:random(a: number, b: number)
-> A: number
Gets a random number.
@param a — The lower threshold (optional).
@param b — The upper threshold (optional).
@return A — random number.
randomseed
function
seed
string
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
setSeed
(method) RNG:setSeed(seed: string)
Sets the seed for the RNG.
@param seed — The seed to set (optional).
setState
(method) RNG:setState(stateTable: table)
Sets the state of the RNG.
@param stateTable — The state to set.
state0
integer
state1
integer
state2
integer
stripName
boolean
RectModification
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) RectModification:__new(placeable: Actor|Cell, topLeft: Vector2, bottomRight: Vector2, fillMode: any)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
bottomRight
Vector2
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
execute
(method) RectModification:execute(attachable: SpectrumAttachable)
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
fillMode
any
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
placeActor
(method) Modification:placeActor(attachable: SpectrumAttachable, x: integer, y: integer, actorPrototype: Actor)
placeBoundaryCell
(method) RectModification:placeBoundaryCell(attachable: SpectrumAttachable, x: number, y: number)
Helper function to place a cell on the boundary
placeCell
(method) Modification:placeCell(attachable: SpectrumAttachable, x: integer, y: integer, cellPrototype: Cell|nil)
placeable
Actor|Cell
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
placed
Actor|Cell[]|nil
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) Modification:removeActor(level: any, actor: any)
removed
table
replaced
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
topLeft
Vector2
undo
(method) Modification:undo(attachable: SpectrumAttachable)
Undoes the modification. Override this method in subclasses to define how the modification is undone.
RectTool
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) RectTool:__new()
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) RectTool:draw(editor: Editor, display: Display)
drawCell
(method) Tool:drawCell(display: Display, drawable: DrawableComponent, x: number, y: number)
Draws a cell at the given coordinates.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getCurrentRect
(method) RectTool:getCurrentRect()
-> topleftx: number?
2. toplefty: number?
3. bottomrightx: number?
4. bottomrighty: number?
Returns the four corners of the current rect.
getDrawable
(method) Tool:getDrawable(placeable: Actor|Cell)
-> DrawableComponent
Returns the DrawableComponent from placeable
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mouseclicked
(method) RectTool:mouseclicked(editor: Editor, attachable: SpectrumAttachable, x: integer, y: integer)
@param x — The cell coordinate clicked.
@param y — The cell coordinate clicked.
mousereleased
(method) RectTool:mousereleased(editor: Editor, attachable: SpectrumAttachable, x: integer, y: integer)
@param x — The cell coordinate clicked.
@param y — The cell coordinate clicked.
origin
Vector2
overrideCellDraw
(method) Tool:overrideCellDraw(editor: Editor, level: Level, cellx: integer, celly: integer)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
second
Vector2
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
update
(method) RectTool:update(dt: number, editor: Editor)
Row
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Row:__new(depth: any, startSlope: any, endSlope: any)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
depth
integer
deserialize
function Object.deserialize(data: any)
-> unknown
eachTile
(method) Row:eachTile()
-> function
endSlope
Fraction
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
next
(method) Row:next()
-> Row
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
roundTiesDown
function Row.roundTiesDown(n: any)
-> integer
roundTiesUp
function Row.roundTiesUp(n: any)
-> integer
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
startSlope
Fraction
stripName
boolean
Scheduler
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Scheduler:__new()
Constructor for the Scheduler class. Initializes an empty queue and sets the actCount to 0.
_serializationBlacklist
table
add
(method) Scheduler:add(actor: string|Actor)
Adds an actor to the scheduler.
@param actor — The actor, or special tick, to add.
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
empty
(method) Scheduler:empty()
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
has
(method) Scheduler:has(actor: Actor)
-> hasActor: boolean
Checks if an actor is in the scheduler.
@param actor — The actor to check.
@return hasActor — True if the actor is in the scheduler, false otherwise.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
next
(method) Scheduler:next()
-> next: Actor
Returns the next actor to act.
@return next — The actor who is next to act.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
remove
(method) Scheduler:remove(actor: Actor)
Removes an actor from the scheduler.
@param actor — The actor to remove.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
timestamp
(method) Scheduler:timestamp()
SelectTool
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) SelectTool:__new()
_serializationBlacklist
table
actors
SparseMap
the copied actors from the attachable
adopt
(method) Object:adopt(o: any)
-> unknown
cells
Grid
the copied cells from the attachable
className
string
A unique name for this class. By convention this should match the annotation name you use.
copy
(method) SelectTool:copy(attachable: SpectrumAttachable)
deserialize
function Object.deserialize(data: any)
-> unknown
dragOrigin
Vector2
where we started dragging from when moving a pasted selection
dragging
boolean
whether we're dragging, either actively creating a selection or pasting one
draw
(method) SelectTool:draw(editor: Editor, display: Display)
drawCell
(method) Tool:drawCell(display: Display, drawable: DrawableComponent, x: number, y: number)
Draws a cell at the given coordinates.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getCurrentRect
(method) SelectTool:getCurrentRect()
-> topleftx: number?
2. toplefty: number?
3. bottomrightx: number?
4. bottomrighty: number?
Returns the four corners of the current rect.
getDrawable
(method) Tool:getDrawable(placeable: Actor|Cell)
-> DrawableComponent
Returns the DrawableComponent from placeable
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mouseclicked
(method) SelectTool:mouseclicked(editor: Editor, attachable: SpectrumAttachable, x: integer, y: integer)
@param x — The cell coordinate clicked.
@param y — The cell coordinate clicked.
mousereleased
(method) SelectTool:mousereleased(editor: Editor, attachable: SpectrumAttachable, x: integer, y: integer)
@param x — The cell coordinate clicked.
@param y — The cell coordinate clicked.
origin
Vector2
location of the first point in a selection (creating or pasted)
overrideCellDraw
(method) Tool:overrideCellDraw(editor: Editor, level: Level, cellx: integer, celly: integer)
paste
(method) SelectTool:paste()
pasted
boolean
whether a selection is currently pasted/active
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
second
Vector2
location of the other point in a selection (creating or pasted)
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
update
(method) SelectTool:update(dt: number, editor: Editor)
SelectionGrid
__getInternal
(method) Inky.Element:__getInternal()
-> Inky.Element.Internal
Get the internal representation of the Element
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Element.Internal
constructor
(method) Inky.Element:constructor(scene: any, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
getView
(method) Inky.Element:getView()
-> x: number
2. y: number
3. w: number
4. h: number
Return the x, y, w, h that the Element was last rendered at
on
(method) Inky.Element:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element
Execute callback when Scene event is raised from the parent Scene \
See: Inky.Scene.raise
onDisable
(method) Inky.Element:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element isn't rendered, when it was rendered last frame
onEnable
(method) Inky.Element:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element is rendered, when it wasn't rendered last frame
onPointer
(method) Inky.Element:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event is raised from an overlapping/capturing Pointer \
See: * Inky.Pointer.raise * Inky.Pointer.captureElement
onPointerEnter
(method) Inky.Element:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer enters the bounding box of the Element
onPointerExit
(method) Inky.Element:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer exits the bounding box of the Element
onPointerInHierarchy
(method) Inky.Element:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event was accepted by a child Element \
See: * Inky.Pointer.raise * Inky.Element.onPointer
props
SelectionGridProps
render
(method) Inky.Element:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element
Render the Element, setting up all the hooks and drawing the Element
Note: The parent Scene's frame must have been begun to be able to render\
useEffect
(method) Inky.Element:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element
Execute a side effect when any specified Element's prop changes
Note: The effect is ran right before a render
useOverlapCheck
(method) Inky.Element:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element
Use an additional check to determine if a Pointer is overlapping an Element
Note: Check is performed after a bounding box check
SelectionGridInit
SelectionGridProps
_internal
Inky.Props.Internal
display
Display
elements
TileElement[]
endRange
number
filtered
number[]
onSelect
function
overlay
love.Canvas
A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as "render to texture".
By drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.
In versions prior to love.graphics.isSupported("canvas") could be used to check for support at runtime.
placeables
Actor|Cell[]
selected
Actor|Cell
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
size
Vector2
the final size of a tile in editor
startRange
number
SelectionPanel
__getInternal
(method) Inky.Element:__getInternal()
-> Inky.Element.Internal
Get the internal representation of the Element
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Element.Internal
constructor
(method) Inky.Element:constructor(scene: any, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
getView
(method) Inky.Element:getView()
-> x: number
2. y: number
3. w: number
4. h: number
Return the x, y, w, h that the Element was last rendered at
on
(method) Inky.Element:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element
Execute callback when Scene event is raised from the parent Scene \
See: Inky.Scene.raise
onDisable
(method) Inky.Element:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element isn't rendered, when it was rendered last frame
onEnable
(method) Inky.Element:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element is rendered, when it wasn't rendered last frame
onPointer
(method) Inky.Element:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event is raised from an overlapping/capturing Pointer \
See: * Inky.Pointer.raise * Inky.Pointer.captureElement
onPointerEnter
(method) Inky.Element:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer enters the bounding box of the Element
onPointerExit
(method) Inky.Element:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer exits the bounding box of the Element
onPointerInHierarchy
(method) Inky.Element:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event was accepted by a child Element \
See: * Inky.Pointer.raise * Inky.Element.onPointer
props
SelectionPanelProps
render
(method) Inky.Element:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element
Render the Element, setting up all the hooks and drawing the Element
Note: The parent Scene's frame must have been begun to be able to render\
useEffect
(method) Inky.Element:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element
Execute a side effect when any specified Element's prop changes
Note: The effect is ran right before a render
useOverlapCheck
(method) Inky.Element:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element
Use an additional check to determine if a Pointer is overlapping an Element
Note: Check is performed after a bounding box check
SelectionPanelInit
SelectionPanelProps
_internal
Inky.Props.Internal
display
Display
editor
Editor
filtered
number[]
overlay
love.Canvas
A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as "render to texture".
By drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.
In versions prior to love.graphics.isSupported("canvas") could be used to check for support at runtime.
placeables
Actor|Cell[]
selected
Actor|Cell
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
selectedText
love.Text
Drawable text.
size
Vector2
SensesComponent
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
actors
ActorStorage
An actor storage with the actors the player is aware of.
adopt
(method) Object:adopt(o: any)
-> unknown
cells
SparseGrid
A sparse grid of cells representing the portion of the map the actor's senses reveal.
checkRequirements
(method) Component:checkRequirements(actor: Actor)
-> meetsRequirements: boolean
Checks whether an actor has the required components to attach this component.
@param actor — The actor to check the requirements against.
@return meetsRequirements — the actor meets all requirements, false otherwise.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
explored
SparseGrid
A sparse grid of cells the actor's senses have previously revealed.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
initialize
(method) SensesComponent:initialize(actor: Actor)
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
Each component prototype MUST have a unique name!
owner
Actor
The Actor this component is composing. This is set by Actor when a component is added or removed.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
requirements
table
A list of component prototypes the actor must first have, before this can be applied.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
unknown
SparseMap<Vector2>
Unkown actors are things the player is aware of the location of, but not the components.
SensesSystem
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
afterAction
(method) System:afterAction(level: Level, actor: Actor, action: Action)
This method is called after an actor has taken an action.
@param level — The Level object this System is attached to.
@param actor — The Actor object that has taken an action.
@param action — The Action object that the Actor has executed.
afterActions
table<Action, fun(level: Level, actor: Actor, action: Action)>
A table mapping specific actions to event hooks.
afterOpacityChanged
(method) System:afterOpacityChanged(level: Level, x: number, y: number)
Called when an actor or tile has its opacity changed.
@param level — The Level object this System is attached to.
@param x — The x coordinate of the tile.
@param y — The y coordinate of the tile.
beforeAction
(method) System:beforeAction(level: Level, actor: Actor, action: Action)
This method is called after an actor has selected an action, but before it is executed.
@param level — The Level object this System is attached to.
@param actor — The Actor object that has selected an action.
@param action — The Action object that the Actor has selected to execute.
beforeActions
table<Action, fun(level: Level, actor: Actor, action: Action)>
A table mapping specific actions to event hooks.
beforeMove
(method) System:beforeMove(level: Level, actor: Actor, from: Vector2, to: Vector2)
This method is called before an actor moves.
@param level — The Level object this System is attached to.
@param actor — The Actor object that is moving.
@param from — The position the Actor is moving from.
@param to — The position the Actor is moving to.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
global
boolean
A system defined global can only be attached to the Game object. It will see all events from all levels.
initialize
(method) System:initialize(level: Level)
This method is called when the Level is initialized. It is called after all of the Systems have been attached.
@param level — The Level object this System is attached to.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
onActorAdded
(method) System:onActorAdded(level: Level, actor: Actor)
This method is called after an actor has been added to the Level.
@param level — The Level object this System is attached to.
@param actor — The Actor object that has been added.
onActorRemoved
(method) System:onActorRemoved(level: Level, actor: Actor)
This method is called after an actor has been removed from the Level.
@param level — The Level object this System is attached to.
@param actor — The Actor object that has been removed.
onDescend
(method) System:onDescend(level: Level)
This method is called when descending to a lower level.
@param level — The Level object this System is attached to.
onMove
(method) System:onMove(level: Level, actor: Actor, from: Vector2, to: Vector2)
This method is called after an actor has moved.
@param level — The Level object this System is attached to.
@param actor — The Actor object that has moved.
@param from — The position the Actor moved from.
@param to — The position the Actor moved to.
onTick
(method) System:onTick(level: Level)
This method is called every 100 units of time, a second, and can be used for mechanics such as hunger and fire spreading.
@param level — The Level object this System is attached to.
onTurn
(method) SensesSystem:onTurn(level: Level, actor: Actor)
onTurnEnd
(method) System:onTurnEnd(level: Level, actor: Actor)
This method is called when a new turn ends.
@param level — The Level object this System is attached to.
@param actor — The Actor object that is about to take its turn.
onYield
(method) SensesSystem:onYield(level: Level, event: Message)
owner
Level?
The level that holds this system.
postInitialize
(method) SensesSystem:postInitialize(level: Level)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
requirements
table
The message system requires the Senses system. While we don't directly reference it here we do grab data off the Senses component
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
softRequirements
string[]
A table of optional requirements that ensure proper order if both Systems are attached.
stripName
boolean
triggerRebuild
(method) SensesSystem:triggerRebuild(level: any, actor: any)
SensesTracker
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) SensesTracker:__new()
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
createSensedMaps
(method) SensesTracker:createSensedMaps(level: Level, curActor: Actor|nil)
deserialize
function Object.deserialize(data: any)
-> unknown
exploredCells
SparseGrid
A grid tracking cells that have been explored by any actor with a PlayerController.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
otherSensedActors
SparseMap
A map tracking actors sensed by other actors (excluding the current actor).
otherSensedCells
SparseGrid
A grid tracking cells sensed by other actors (excluding the current actor).
passableCallback
(method) SensesTracker:passableCallback()
-> function
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
totalSensedActors
SparseMap
A map tracking all actors sensed by the current actor or others.
SimpleScheduler
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) SimpleScheduler:__new()
Constructor for the SimpleScheduler class. Initializes an empty queue and sets the round count to 0.
_serializationBlacklist
table
add
(method) SimpleScheduler:add(actor: string|Actor)
Adds an actor to the scheduler.
@param actor — The actor, or special tick, to add.
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
currentQueue
Queue
A basic FIFO (First In, First Out) queue implementation.
deserialize
function Object.deserialize(data: any)
-> unknown
empty
(method) SimpleScheduler:empty()
-> boolean
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
has
(method) SimpleScheduler:has(actor: Actor)
-> True: boolean
Checks if an actor is in the scheduler.
@param actor — The actor to check.
@return True — if the actor is in the scheduler, false otherwise.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
next
(method) SimpleScheduler:next()
-> The: Actor
Returns the next actor to act. Moves the actor to the next queue and returns the actor. If the current queue is empty, it swaps the current and next queues and increments the round count.
@return The — actor who is next to act.
nextQueue
Queue
A basic FIFO (First In, First Out) queue implementation.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
remove
(method) SimpleScheduler:remove(actor: Actor)
Removes an actor from the scheduler.
@param actor — The actor to remove.
roundCount
integer
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
swapQueues
(method) SimpleScheduler:swapQueues()
Swaps the current and next queues.
timestamp
(method) SimpleScheduler:timestamp()
-> The: number
Returns the current round count as a timestamp.
@return The — current round count.
SparseArray
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) SparseArray:__new()
Constructor for SparseArray.
_serializationBlacklist
table
add
(method) SparseArray:add(item: any)
-> index: number
Adds an item to the sparse array.
@param item — The item to add.
@return index — The index where the item was added.
adopt
(method) Object:adopt(o: any)
-> unknown
bake
(method) SparseArray:bake()
-> The: table
Bakes the sparse array into a dense array. This removes all nil values and reassigns indices.
@return The — new dense array.
className
string
A unique name for this class. By convention this should match the annotation name you use.
clear
(method) SparseArray:clear()
Clears the sparse array.
data
table
Holds the actual values
debugPrint
(method) SparseArray:debugPrint()
Prints the sparse array for debugging purposes.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
freeIndices
table
Tracks free indices
get
(method) SparseArray:get(index: number)
-> The: any
Gets an item from the sparse array.
@param index — The index of the item.
@return The — item at the specified index, or nil if none exists.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
remove
(method) SparseArray:remove(index: number)
Removes an item from the sparse array.
@param index — The index to remove the item from.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
SparseGrid
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) SparseGrid:__new()
-> SparseGrid
The constructor for the 'SparseGrid' class. Initializes the sparse grid with an empty data table.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
clear
(method) SparseGrid:clear()
Clears all values in the sparse grid.
data
table
deserialize
function Object.deserialize(data: any)
-> unknown
each
(method) SparseGrid:each()
-> iter: fun(x: integer, y: integer, V: any)
Iterator function for the SparseGrid. Iterates over all entries in the sparse grid, returning the coordinates and value for each entry.
@return iter — An iterator function that returns the x-coordinate, y-coordinate, and value for each entry.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
get
(method) SparseGrid:get(x: integer, y: integer)
-> value: any
Gets the value at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@return value — The value at the specified coordinates, or nil if not set.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
set
(method) SparseGrid:set(x: integer, y: integer, value: any)
Sets the value at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@param value — The value to set.
stripName
boolean
SparseMap
__call
function
__count
integer
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) SparseMap:__new()
The constructor for the 'SparseMap' class. Initializes the map and counters.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
contains
(method) SparseMap:contains(value: any)
-> containsValue: boolean
Checks where the specified value exists within the map.
count
(method) SparseMap:count()
-> The: number
Returns the total number of entries in the sparse map.
@return The — total number of entries.
countCell
(method) SparseMap:countCell(x: integer, y: integer)
-> The: number
Returns the number of values stored at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@return The — number of values stored at the specified coordinates.
deserialize
function Object.deserialize(data: any)
-> unknown
each
(method) SparseMap:each()
-> An: function
Returns an iterator over all entries in the sparse map.
@return An — iterator that returns the value, coordinates, and hash for each entry.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
get
(method) SparseMap:get(x: integer, y: integer)
-> elements: table
Gets the values stored at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@return elements — A set[actor]=bool of values stored at the specified coordinates, or an empty table if none.
getByHash
(method) SparseMap:getByHash(hash: number)
-> A: table
Gets the values stored at the specified hash.
@param hash — The hash value of the coordinates.
@return A — table of values stored at the specified hash, or an empty table if none.
has
(method) SparseMap:has(x: integer, y: integer, value: any)
-> True: boolean
Checks whether the specified value is stored at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@param value — The value to check.
@return True — if the value is stored at the specified coordinates, false otherwise.
insert
(method) SparseMap:insert(x: integer, y: integer, val: any)
Inserts a value at the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@param val — The value to insert.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
list
table
map
table
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
remove
(method) SparseMap:remove(x: integer, y: integer, val: any)
-> True: boolean
Removes a value from the specified coordinates.
@param x — The x-coordinate.
@param y — The y-coordinate.
@param val — The value to remove.
@return True — if the value was successfully removed, false otherwise.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
SpectrumAttachable
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
addActor
fun(self: any, actor: Actor)
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
debug
boolean
deserialize
function Object.deserialize(data: any)
-> unknown
eachActor
fun(self: any):fun()
eachActorAt
fun(self: any, x: integer, y: integer):fun()
eachCell
fun(self: any):fun()
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getActorsAt
fun(self: any, x: integer, y: integer)
getCell
fun(self: any, x: integer, y: integer):Cell
inBounds
fun(self: any, x: integer, y: integer)
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
fun(self: any, actor: Actor)
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
setCell
fun(self: any, x: integer, y: integer, cell: Cell|nil)
stripName
boolean
SpriteAtlas
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) SpriteAtlas:__new(imagePath: string, spriteData: table, names: string[])
The constructor for the SpriteAtlas class
@param imagePath — The path to the texture atlas image
@param spriteData — A table containing sprite names and their respective quads
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
drawByIndex
(method) SpriteAtlas:drawByIndex(index: number, x: number, y: number)
Draws a sprite by index at the given position
@param index — The index of the sprite
@param x — The x coordinate to draw the sprite
@param y — The y coordinate to draw the sprite
drawByName
(method) SpriteAtlas:drawByName(name: string, x: number, y: number)
Draws a sprite by name at the given position
@param name — The name of the sprite
@param x — The x coordinate to draw the sprite
@param y — The y coordinate to draw the sprite
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
fromAtlased
function SpriteAtlas.fromAtlased(imagePath: string, jsonPath: string)
-> The: SpriteAtlas
Creates a SpriteAtlas from an Atlased JSON and PNG file
@param imagePath — The path to the texture atlas image
@param jsonPath — The path to the Atlased JSON file
@return The — created SpriteAtlas instance
fromGrid
function SpriteAtlas.fromGrid(imagePath: string, cellWidth: number, cellHeight: number, names?: table)
-> The: SpriteAtlas
Creates a SpriteAtlas from a grid of cells
@param imagePath — The path to the texture atlas image
@param cellWidth — The width of each cell in the grid
@param cellHeight — The height of each cell in the grid
@param names — The names of the sprites, mapping left to right, top to bottom. If not supplied the quads will be sorted by index not name.
@return The — created SpriteAtlas instance
getQuadByIndex
(method) SpriteAtlas:getQuadByIndex(index: number)
-> quad: any
Gets a quad by index
@param index — The index of the sprite
@return quad — The love quad associated with the sprite index
getQuadByName
(method) SpriteAtlas:getQuadByName(name: string)
-> quad: any
Gets a quad by name
@param name — The name of the sprite
@return quad — The love quad associated with the sprite name
image
any
The texture atlas love image
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
quadsByIndex
table<number, any>
A table of quads indexed by sprite indices
quadsByName
table<string, any>
A table of quads indexed by sprite names
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
System
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
afterAction
(method) System:afterAction(level: Level, actor: Actor, action: Action)
This method is called after an actor has taken an action.
@param level — The Level object this System is attached to.
@param actor — The Actor object that has taken an action.
@param action — The Action object that the Actor has executed.
afterActions
table<Action, fun(level: Level, actor: Actor, action: Action)>
A table mapping specific actions to event hooks.
afterOpacityChanged
(method) System:afterOpacityChanged(level: Level, x: number, y: number)
Called when an actor or tile has its opacity changed.
@param level — The Level object this System is attached to.
@param x — The x coordinate of the tile.
@param y — The y coordinate of the tile.
beforeAction
(method) System:beforeAction(level: Level, actor: Actor, action: Action)
This method is called after an actor has selected an action, but before it is executed.
@param level — The Level object this System is attached to.
@param actor — The Actor object that has selected an action.
@param action — The Action object that the Actor has selected to execute.
beforeActions
table<Action, fun(level: Level, actor: Actor, action: Action)>
A table mapping specific actions to event hooks.
beforeMove
(method) System:beforeMove(level: Level, actor: Actor, from: Vector2, to: Vector2)
This method is called before an actor moves.
@param level — The Level object this System is attached to.
@param actor — The Actor object that is moving.
@param from — The position the Actor is moving from.
@param to — The position the Actor is moving to.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
global
boolean
A system defined global can only be attached to the Game object. It will see all events from all levels.
initialize
(method) System:initialize(level: Level)
This method is called when the Level is initialized. It is called after all of the Systems have been attached.
@param level — The Level object this System is attached to.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
name
string
A system must define a name that is unique to the System.
onActorAdded
(method) System:onActorAdded(level: Level, actor: Actor)
This method is called after an actor has been added to the Level.
@param level — The Level object this System is attached to.
@param actor — The Actor object that has been added.
onActorRemoved
(method) System:onActorRemoved(level: Level, actor: Actor)
This method is called after an actor has been removed from the Level.
@param level — The Level object this System is attached to.
@param actor — The Actor object that has been removed.
onDescend
(method) System:onDescend(level: Level)
This method is called when descending to a lower level.
@param level — The Level object this System is attached to.
onMove
(method) System:onMove(level: Level, actor: Actor, from: Vector2, to: Vector2)
This method is called after an actor has moved.
@param level — The Level object this System is attached to.
@param actor — The Actor object that has moved.
@param from — The position the Actor moved from.
@param to — The position the Actor moved to.
onTick
(method) System:onTick(level: Level)
This method is called every 100 units of time, a second, and can be used for mechanics such as hunger and fire spreading.
@param level — The Level object this System is attached to.
onTurn
(method) System:onTurn(level: Level, actor: Actor)
This method is called when a new turn begins. The actor is the actor that is about to take their turn.
@param level — The Level object this System is attached to.
@param actor — The Actor object that is about to take its turn.
onTurnEnd
(method) System:onTurnEnd(level: Level, actor: Actor)
This method is called when a new turn ends.
@param level — The Level object this System is attached to.
@param actor — The Actor object that is about to take its turn.
onYield
(method) System:onYield(level: Level, event: Message)
This method is called whenever the level yields back to the interface. The most common usage for this right now is updating the sight component of any input controlled actors in the Sight system.
@param level — The Level object this System is attached to.
@param event — The event data that caused the yield.
owner
Level?
The level that holds this system.
postInitialize
(method) System:postInitialize(level: Level)
This method is called after the Level is initialized. It is called after all of the Systems have been initialized.
@param level — The Level object this System is attached to.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
requirements
string[]
A table of requirements that must be met for the System to be attached to a Level.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
softRequirements
string[]
A table of optional requirements that ensure proper order if both Systems are attached.
stripName
boolean
SystemManager
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) SystemManager:__new(owner: Level)
_serializationBlacklist
table
addSystem
(method) SystemManager:addSystem(system: System)
Adds a system to the manager.
@param system — The system to add.
adopt
(method) Object:adopt(o: any)
-> unknown
afterAction
(method) SystemManager:afterAction(level: Level, actor: Actor, action: Action)
Calls the afterAction method for all systems.
@param level — The level to call afterAction for.
@param actor — The actor that has taken an action.
@param action — The action the actor has executed.
afterOpacityChanged
(method) SystemManager:afterOpacityChanged(level: Level, x: number, y: number)
Calls the afterOpacityChanged method for all systems.
@param level — The level to call afterOpacityChanged for.
@param x — The x coordinate of the tile.
@param y — The y coordinate of the tile.
beforeAction
(method) SystemManager:beforeAction(level: Level, actor: Actor, action: Action)
Calls the beforeAction method for all systems.
@param level — The level to call beforeAction for.
@param actor — The actor that has selected an action.
@param action — The action the actor has selected.
beforeMove
(method) SystemManager:beforeMove(level: Level, actor: Actor, from: Vector2, to: Vector2)
Calls the beforeMove method for all systems.
@param level — The level to call beforeMove for.
@param actor — The actor that is moving.
@param from — The position the actor is moving from.
@param to — The position the actor is moving to.
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getSystem
(method) SystemManager:getSystem(systemName: string)
-> The: System?
Gets a system by name.
@param systemName — The name of the system to get.
@return The — system with the given name, or nil if not found.
initialize
(method) SystemManager:initialize(level: Level)
Initializes all systems attached to the manager.
@param level — The level to initialize the systems for.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
onActorAdded
(method) SystemManager:onActorAdded(level: Level, actor: Actor)
Calls the onActorAdded method for all systems.
@param level — The level to call onActorAdded for.
@param actor — The actor that has been added.
onActorRemoved
(method) SystemManager:onActorRemoved(level: Level, actor: Actor)
Calls the onActorRemoved method for all systems.
@param level — The level to call onActorRemoved for.
@param actor — The actor that has been removed.
onMove
(method) SystemManager:onMove(level: Level, actor: Actor, from: Vector2, to: Vector2)
Calls the onMove method for all systems.
@param level — The level to call onMove for.
@param actor — The actor that has moved.
@param from — The position the actor moved from.
@param to — The position the actor moved to.
onTick
(method) SystemManager:onTick(level: Level)
Calls the onTick method for all systems.
@param level — The level to call onTick for.
onTurn
(method) SystemManager:onTurn(level: Level, actor: Actor)
Calls the onTurn method for all systems.
@param level — The level to call onTurn for.
@param actor — The actor taking its turn.
onTurnEnd
(method) SystemManager:onTurnEnd(level: Level, actor: Actor)
Calls the onTurn method for all systems.
@param level — The level to call onTurn for.
@param actor — The actor taking its turn.
onYield
(method) SystemManager:onYield(level: Level, event: Message)
Calls the on yield method for each system right before the level hands a Decision back to the interface. Used by the Sight system to ensure that the player's fov is always updated when we yield even if it's not their turn.
@param level — The level to call onYield for.
@param event — The event data that caused the yield.
owner
Level
The 'Level' holds all of the actors and systems, and runs the game loop. Through the ActorStorage and SystemManager
postInitialize
(method) SystemManager:postInitialize(level: Level)
Post-initializes all systems after the level has been populated.
@param level — The level to post-initialize the systems for.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
systems
System[]
trigger
(method) SystemManager:trigger(eventString: string, ...any)
This is useful for calling custom events you define in your Actions, Systems, etc. An example usage of this can be found in the Sight system.
@param eventString — The key of the event handler method into the system.
@param ... — The arguments to be passed to the event handler method.
Target
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
_validate
(method) Target:_validate(owner: Actor, targetObject: any, targets: [Object])
-> boolean
@param owner — The owner of the action.
@param targetObject — The target object of the action.
@param targets — A list of the previous targets.
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
distanceType
"4way"|"8way"|"chebyshev"|"euclidean"|"manhattan"
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
range
number
The distance in tiles this actor can be away from the Action's owner. If nil this check is skipped.
rangeLastTarget
nil
rangeType
"chebyshev"|"manhattan"
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
typesAllowed
table<"Actor"|"Any"|"Cell"|"Point", true>
unique
boolean
If true this will make sure this target is unique, and not one of the targets already selected.
validate
(method) Target:validate(owner: Actor, targetObject: Actor|Cell|Vector2, targets: any)
-> boolean
The inner validate for the target. This is what you override with your own custom logic.
@param owner — The actor performing the action.
@param targetObject — The target to validate.
TargetType
TextInput
__getInternal
(method) Inky.Element:__getInternal()
-> Inky.Element.Internal
Get the internal representation of the Element
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Element.Internal
constructor
(method) Inky.Element:constructor(scene: any, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
getView
(method) Inky.Element:getView()
-> x: number
2. y: number
3. w: number
4. h: number
Return the x, y, w, h that the Element was last rendered at
on
(method) Inky.Element:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element
Execute callback when Scene event is raised from the parent Scene \
See: Inky.Scene.raise
onDisable
(method) Inky.Element:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element isn't rendered, when it was rendered last frame
onEnable
(method) Inky.Element:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element is rendered, when it wasn't rendered last frame
onPointer
(method) Inky.Element:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event is raised from an overlapping/capturing Pointer \
See: * Inky.Pointer.raise * Inky.Pointer.captureElement
onPointerEnter
(method) Inky.Element:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer enters the bounding box of the Element
onPointerExit
(method) Inky.Element:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer exits the bounding box of the Element
onPointerInHierarchy
(method) Inky.Element:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event was accepted by a child Element \
See: * Inky.Pointer.raise * Inky.Element.onPointer
props
TextInputProps
render
(method) Inky.Element:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element
Render the Element, setting up all the hooks and drawing the Element
Note: The parent Scene's frame must have been begun to be able to render\
useEffect
(method) Inky.Element:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element
Execute a side effect when any specified Element's prop changes
Note: The effect is ran right before a render
useOverlapCheck
(method) Inky.Element:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element
Use an additional check to determine if a Pointer is overlapping an Element
Note: Check is performed after a bounding box check
TextInputInit
TextInputProps
_internal
Inky.Props.Internal
content
string
focused
boolean
font
love.Font
Defines the shape of characters that can be drawn onto the screen.
limit
number
the number of characters before we start panning
onEdit
function?
overlay
love.Canvas
A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as "render to texture".
By drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.
In versions prior to love.graphics.isSupported("canvas") could be used to check for support at runtime.
placeholder
string
size
Vector2
TileElement
__getInternal
(method) Inky.Element:__getInternal()
-> Inky.Element.Internal
Get the internal representation of the Element
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Element.Internal
constructor
(method) Inky.Element:constructor(scene: any, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
getView
(method) Inky.Element:getView()
-> x: number
2. y: number
3. w: number
4. h: number
Return the x, y, w, h that the Element was last rendered at
on
(method) Inky.Element:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element
Execute callback when Scene event is raised from the parent Scene \
See: Inky.Scene.raise
onDisable
(method) Inky.Element:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element isn't rendered, when it was rendered last frame
onEnable
(method) Inky.Element:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element is rendered, when it wasn't rendered last frame
onPointer
(method) Inky.Element:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event is raised from an overlapping/capturing Pointer \
See: * Inky.Pointer.raise * Inky.Pointer.captureElement
onPointerEnter
(method) Inky.Element:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer enters the bounding box of the Element
onPointerExit
(method) Inky.Element:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer exits the bounding box of the Element
onPointerInHierarchy
(method) Inky.Element:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event was accepted by a child Element \
See: * Inky.Pointer.raise * Inky.Element.onPointer
props
TileElementProps
render
(method) Inky.Element:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element
Render the Element, setting up all the hooks and drawing the Element
Note: The parent Scene's frame must have been begun to be able to render\
useEffect
(method) Inky.Element:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element
Execute a side effect when any specified Element's prop changes
Note: The effect is ran right before a render
useOverlapCheck
(method) Inky.Element:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element
Use an additional check to determine if a Pointer is overlapping an Element
Note: Check is performed after a bounding box check
TileElementProps
_internal
Inky.Props.Internal
display
Display
onSelect
function
overlay
love.Canvas
A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as "render to texture".
By drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.
In versions prior to love.graphics.isSupported("canvas") could be used to check for support at runtime.
placeable
Actor|Cell
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
size
Vector2
the final size of a tile in editor
Tool
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) Object:__new(...any)
The default constructor for the class. Subclasses should override this.
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
draw
(method) Tool:draw(editor: Editor, display: Display)
Draws the tool visuals.
drawCell
(method) Tool:drawCell(display: Display, drawable: DrawableComponent, x: number, y: number)
Draws a cell at the given coordinates.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getDrawable
(method) Tool:getDrawable(placeable: Actor|Cell)
-> DrawableComponent
Returns the DrawableComponent from placeable
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
mouseclicked
(method) Tool:mouseclicked(editor: Editor, level: any, cellx: number, celly: number)
Handles mouse click events.
@param cellx — The x-coordinate of the cell clicked.
@param celly — The y-coordinate of the cell clicked.
mousereleased
(method) Tool:mousereleased(editor: Editor, level: any, cellx: number, celly: number)
Handles mouse release events.
@param cellx — The x-coordinate of the cell release.
@param celly — The y-coordinate of the cell release.
overrideCellDraw
(method) Tool:overrideCellDraw(editor: Editor, level: Level, cellx: integer, celly: integer)
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
update
(method) Tool:update(dt: number, editor: Editor)
Updates the tool state.
@param dt — The time delta since the last update.
@param editor — The editor instance.
Tools
__getInternal
(method) Inky.Element:__getInternal()
-> Inky.Element.Internal
Get the internal representation of the Element
For internal use\ Don't touch unless you know what you're doing
_internal
Inky.Element.Internal
constructor
(method) Inky.Element:constructor(scene: any, initializer: fun(self: Inky.Element, scene: Inky.Scene):fun(self: Inky.Element, x: number, y: number, w: number, h: number, depth?: number))
getView
(method) Inky.Element:getView()
-> x: number
2. y: number
3. w: number
4. h: number
Return the x, y, w, h that the Element was last rendered at
on
(method) Inky.Element:on(eventName: string, callback: fun(element: Inky.Element, ...any):nil)
-> Inky.Element
Execute callback when Scene event is raised from the parent Scene \
See: Inky.Scene.raise
onDisable
(method) Inky.Element:onDisable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element isn't rendered, when it was rendered last frame
onEnable
(method) Inky.Element:onEnable(callback?: fun(element: Inky.Element):nil)
-> Inky.Element
Execute callback when an Element is rendered, when it wasn't rendered last frame
onPointer
(method) Inky.Element:onPointer(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event is raised from an overlapping/capturing Pointer \
See: * Inky.Pointer.raise * Inky.Pointer.captureElement
onPointerEnter
(method) Inky.Element:onPointerEnter(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer enters the bounding box of the Element
onPointerExit
(method) Inky.Element:onPointerExit(callback: fun(element: Inky.Element, pointer: Inky.Pointer):nil)
-> Inky.Element
Execute callback when a Pointer exits the bounding box of the Element
onPointerInHierarchy
(method) Inky.Element:onPointerInHierarchy(eventName: string, callback: fun(element: Inky.Element, pointer: Inky.Pointer, ...any):nil)
-> Inky.Element
Execute callback when a Pointer event was accepted by a child Element \
See: * Inky.Pointer.raise * Inky.Element.onPointer
props
ToolsProps
render
(method) Inky.Element:render(x: number, y: number, w: number, h: number, depth?: number)
-> Inky.Element
Render the Element, setting up all the hooks and drawing the Element
Note: The parent Scene's frame must have been begun to be able to render\
useEffect
(method) Inky.Element:useEffect(effect: fun(element: Inky.Element):nil, ...any)
-> Inky.Element
Execute a side effect when any specified Element's prop changes
Note: The effect is ran right before a render
useOverlapCheck
(method) Inky.Element:useOverlapCheck(predicate: fun(pointerX: number, pointerY: number, x: number, y: number, w: number, h: number):boolean)
-> Inky.Element
Use an additional check to determine if a Pointer is overlapping an Element
Note: Check is performed after a bounding box check
ToolsInit
ToolsProps
_internal
Inky.Props.Internal
editor
Editor
selected
Button
Trace
UnfloatSelectionModification
__call
function
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__new
(method) UnfloatSelectionModification:__new(placeable: any, position: any, floatingSelection: any)
_serializationBlacklist
table
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
deserialize
function Object.deserialize(data: any)
-> unknown
execute
(method) UnfloatSelectionModification:execute(attachable: SpectrumAttachable)
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
floatingSelection
MapBuilder
A map builder class that extends the SparseGrid class to handle map-specific functionalities.
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
placeActor
(method) Modification:placeActor(attachable: SpectrumAttachable, x: integer, y: integer, actorPrototype: Actor)
placeCell
(method) Modification:placeCell(attachable: SpectrumAttachable, x: integer, y: integer, cellPrototype: Cell|nil)
placeable
Actor|Cell
An 'Actor' represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
placed
table
position
Vector2
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
removeActor
(method) Modification:removeActor(level: any, actor: any)
removed
table
replaced
SparseGrid
A sparse grid class that stores data using hashed coordinates. Similar to a SparseMap except here there is only one entry per grid coordinate. This is suitable for stuff like Cells.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
undo
(method) Modification:undo(attachable: SpectrumAttachable)
Undoes the modification. Override this method in subclasses to define how the modification is undone.
Vector2
DOWN
Vector2
The static DOWN vector.
DOWN_LEFT
Vector2
The static DOWN_LEFT vector.
DOWN_RIGHT
Vector2
The static DOWN_RIGHT vector.
LEFT
Vector2
The static LEFT vector.
RIGHT
Vector2
The static RIGHT vector.
UP
Vector2
The static UP vector.
UP_LEFT
Vector2
The static UP_LEFT vector.
UP_RIGHT
Vector2
The static UP_RIGHT vector.
__add
function Vector2.__add(a: Vector2, b: Vector2)
-> Vector2
Adds two vectors together.
@param a — The first vector.
@param b — The second vector.
@return — The sum of the two vectors.
__call
function
__eq
function Vector2.__eq(a: Vector2, b: Vector2)
-> boolean
Checks the equality of two vectors.
@param a — The first vector.
@param b — The second vector.
@return — True if the vectors are equal, false otherwise.
__index
Object
A simple class system for Lua. This is the base class for all other classes in PRISM.
__mul
function Vector2.__mul(a: Vector2, b: number)
-> Vector2
Multiplies a vector by a scalar.
@param a — The vector.
@param b — The scalar.
@return — The product of the vector and the scalar.
__new
(method) Vector2:__new(x: number, y: number)
Constructor for Vector2 accepts two numbers, x and y.
@param x — The x component of the vector.
@param y — The y component of the vector.
__sub
function Vector2.__sub(a: Vector2, b: Vector2)
-> Vector2
Subtracts vector b from vector a.
@param a — The first vector.
@param b — The second vector.
@return — The difference of the two vectors.
__tostring
(method) Vector2:__tostring()
-> string
Creates a string representation of the vector.
@return — The string representation of the vector.
__unm
function Vector2.__unm(a: Vector2)
-> Vector2
Negates the vector.
@param a — The vector to negate.
@return — The negated vector.
_hash
function Vector2._hash(x: integer, y: integer)
-> integer
_serializationBlacklist
table
_unhash
function Vector2._unhash(hash: number)
-> number
2. integer
adopt
(method) Object:adopt(o: any)
-> unknown
className
string
A unique name for this class. By convention this should match the annotation name you use.
copy
(method) Vector2:copy()
-> Vector2
Returns a copy of the vector.
@return — A copy of the vector.
decompose
(method) Vector2:decompose()
-> x: number
2. y: number
@return x — The x component of the vector.
@return y — The y component of the vector.
deserialize
function Object.deserialize(data: any)
-> unknown
distance
(method) Vector2:distance(vec: Vector2)
-> distance: number
Euclidian distance from another point.
distanceChebyshev
(method) Vector2:distanceChebyshev(vec: Vector2)
-> distance: number
Chebyshev distance from another point.
distanceManhattan
(method) Vector2:distanceManhattan(vec: Vector2)
-> distance: number
Manhattan distance from another point.
extend
(method) Object:extend(className: string, ignoreclassName?: boolean)
-> prototype: <T>
Creates a new class and sets its metatable to the extended class.
@param className — name for the class
@param ignoreclassName — if true, skips the uniqueness check in prism's registry
@return prototype — The new class prototype extended from this one.
getRange
(method) Vector2:getRange(type: "4way"|"8way"|"chebyshev"|"euclidean"|"manhattan", vec: Vector2)
-> number
Gets the range, a ciel'd integer representing the number of tiles away the other vector is
type:
| "euclidean"
| "chebyshev"
| "manhattan"
| "4way"
| "8way"
hash
(method) Vector2:hash()
-> hash: number
instanceOf
(method) Object:instanceOf(o: table)
-> extends: boolean
Checks if o is the first class in the inheritance chain of self.
@param o — The class to check.
@return extends — True if o is the first class in the inheritance chain of self, false otherwise.
is
(method) Object:is(o: table)
-> is: boolean
Checks if o is in the inheritance chain of self.
@param o — The class to check.
@return is — True if o is in the inheritance chain of self, false otherwise.
length
(method) Vector2:length()
-> number
Returns the length of the vector.
@return — The length of the vector.
lerp
(method) Vector2:lerp(vec: Vector2, t: number)
-> Vector2
Linearly interpolates between two vectors.
@param self — The starting vector (A).
@param vec — The ending vector (B).
@param t — The interpolation factor (0 <= t <= 1).
@return — The interpolated vector.
mixin
(method) Object:mixin(mixin: table)
-> Object
Mixes in methods and properties from another table, excluding blacklisted metamethods. THis does not deep copy or merge tables, currently. It's a shallow mixin.
@param mixin — The table containing methods and properties to mix in.
neighborhood4
Vector2[]
neighborhood8
Vector2[]
prettyprint
function Object.prettyprint(obj: table, indent: string, visited: table)
-> string
Pretty-prints an object for debugging or visualization.
@param obj — The object to pretty-print.
@param indent — The current indentation level (used for recursion).
@param visited — A table of visited objects to prevent circular references.
rotateClockwise
(method) Vector2:rotateClockwise()
-> The: Vector2
Rotates the vector clockwise.
@return The — rotated vector.
serializationBlacklist
table<string, boolean>
serialize
function Object.serialize(object: any)
-> table
stripName
boolean
unhash
function Vector2.unhash(hash: any)
-> Vector2
x
number
The x component of the vector.
y
number
The y component of the vector.
_G
_G
_G
_VERSION
string
any
arg
string[]
assert
function assert(v?: <T>, message?: any, ...any)
-> <T>
2. ...any
bit
bitlib
bit.arshift
function bit.arshift(x: integer, n: integer)
-> y: integer
bit.band
function bit.band(x: integer, ...integer)
-> y: integer
bit.bnot
function bit.bnot(x: integer)
-> y: integer
bit.bor
function bit.bor(x: integer, ...integer)
-> y: integer
bit.bswap
function bit.bswap(x: integer)
-> y: integer
bit.bxor
function bit.bxor(x: integer, ...integer)
-> y: integer
bit.lshift
function bit.lshift(x: integer, n: integer)
-> y: integer
bit.rol
function bit.rol(x: integer, n: integer)
-> y: integer
bit.ror
function bit.ror(x: integer, n: integer)
-> y: integer
bit.rshift
function bit.rshift(x: integer, n: integer)
-> y: integer
bit.tobit
function bit.tobit(x: integer)
-> y: integer
bit.tohex
function bit.tohex(x: integer, n?: integer)
-> y: string
bitlib
arshift
function bit.arshift(x: integer, n: integer)
-> y: integer
band
function bit.band(x: integer, ...integer)
-> y: integer
bnot
function bit.bnot(x: integer)
-> y: integer
bor
function bit.bor(x: integer, ...integer)
-> y: integer
bswap
function bit.bswap(x: integer)
-> y: integer
bxor
function bit.bxor(x: integer, ...integer)
-> y: integer
lshift
function bit.lshift(x: integer, n: integer)
-> y: integer
rol
function bit.rol(x: integer, n: integer)
-> y: integer
ror
function bit.ror(x: integer, n: integer)
-> y: integer
rshift
function bit.rshift(x: integer, n: integer)
-> y: integer
tobit
function bit.tobit(x: integer)
-> y: integer
tohex
function bit.tohex(x: integer, n?: integer)
-> y: string
boolean
collectgarbage
function collectgarbage(opt?: "collect"|"count"|"isrunning"|"restart"|"setpause"...(+3), arg?: integer)
-> any
coroutine
coroutinelib
coroutine.close
function coroutine.close(co: thread)
-> noerror: boolean
2. errorobject: any
coroutine.create
function coroutine.create(f: fun(...any):...unknown)
-> thread
coroutine.isyieldable
function coroutine.isyieldable()
-> boolean
coroutine.resume
function coroutine.resume(co: thread, val1?: any, ...any)
-> success: boolean
2. ...any
coroutine.running
function coroutine.running()
-> running: thread
2. ismain: boolean
coroutine.status
function coroutine.status(co: thread)
-> "dead"|"normal"|"running"|"suspended"
coroutine.wrap
function coroutine.wrap(f: fun(...any):...unknown)
-> fun(...any):...unknown
coroutine.yield
(async) function coroutine.yield(...any)
-> ...any
coroutinelib
close
function coroutine.close(co: thread)
-> noerror: boolean
2. errorobject: any
Closes coroutine co , closing all its pending to-be-closed variables and putting the coroutine in a dead state.
create
function coroutine.create(f: fun(...any):...unknown)
-> thread
Creates a new coroutine, with body f. f must be a function. Returns this new coroutine, an object with type "thread".
isyieldable
function coroutine.isyieldable()
-> boolean
Returns true when the running coroutine can yield.
resume
function coroutine.resume(co: thread, val1?: any, ...any)
-> success: boolean
2. ...any
Starts or continues the execution of coroutine co.
running
function coroutine.running()
-> running: thread
2. ismain: boolean
Returns the running coroutine plus a boolean, true when the running coroutine is the main one.
status
function coroutine.status(co: thread)
-> "dead"|"normal"|"running"|"suspended"
Returns the status of coroutine co.
return #1:
| "running" -- Is running.
| "suspended" -- Is suspended or not started.
| "normal" -- Is active but not running.
| "dead" -- Has finished or stopped with an error.
wrap
function coroutine.wrap(f: fun(...any):...unknown)
-> fun(...any):...unknown
Creates a new coroutine, with body f; f must be a function. Returns a function that resumes the coroutine each time it is called.
yield
(async) function coroutine.yield(...any)
-> ...any
Suspends the execution of the calling coroutine.
debug
debuglib
debug.debug
function debug.debug()
debug.getfenv
function debug.getfenv(o: any)
-> table
debug.gethook
function debug.gethook(co?: thread)
-> hook: function
2. mask: string
3. count: integer
debug.getinfo
function debug.getinfo(thread: thread, f: integer|fun(...any):...unknown, what?: string|"L"|"S"|"f"|"l"...(+3))
-> debuginfo
debug.getlocal
function debug.getlocal(thread: thread, f: integer|fun(...any):...unknown, index: integer)
-> name: string
2. value: any
debug.getmetatable
function debug.getmetatable(object: any)
-> metatable: table
debug.getregistry
function debug.getregistry()
-> table
debug.getupvalue
function debug.getupvalue(f: fun(...any):...unknown, up: integer)
-> name: string
2. value: any
debug.getuservalue
function debug.getuservalue(u: userdata)
-> any
debug.setcstacklimit
function debug.setcstacklimit(limit: integer)
-> boolean|integer
debug.setfenv
function debug.setfenv(object: <T>, env: table)
-> object: <T>
debug.sethook
function debug.sethook(thread: thread, hook: fun(...any):...unknown, mask: string|"c"|"l"|"r", count?: integer)
debug.setlocal
function debug.setlocal(thread: thread, level: integer, index: integer, value: any)
-> name: string
debug.setmetatable
function debug.setmetatable(value: <T>, meta?: table)
-> value: <T>
debug.setupvalue
function debug.setupvalue(f: fun(...any):...unknown, up: integer, value: any)
-> name: string
debug.setuservalue
function debug.setuservalue(udata: userdata, value: any)
-> udata: userdata
debug.traceback
function debug.traceback(thread: thread, message?: any, level?: integer)
-> message: string
debug.upvalueid
function debug.upvalueid(f: fun(...any):...unknown, n: integer)
-> id: lightuserdata
debug.upvaluejoin
function debug.upvaluejoin(f1: fun(...any):...unknown, n1: integer, f2: fun(...any):...unknown, n2: integer)
debuginfo
activelines
table
currentline
integer
func
function
istailcall
boolean
isvararg
boolean
lastlinedefined
integer
linedefined
integer
name
string
namewhat
string
nparams
integer
nups
integer
short_src
string
source
string
what
string
debuglib
debug
function debug.debug()
Enters an interactive mode with the user, running each string that the user enters.
getfenv
function debug.getfenv(o: any)
-> table
Returns the environment of object o .
gethook
function debug.gethook(co?: thread)
-> hook: function
2. mask: string
3. count: integer
Returns the current hook settings of the thread.
getinfo
function debug.getinfo(thread: thread, f: integer|fun(...any):...unknown, what?: string|"L"|"S"|"f"|"l"...(+3))
-> debuginfo
Returns a table with information about a function.
what:
+> "n" -- `name` and `namewhat`
+> "S" -- `source`, `short_src`, `linedefined`, `lastlinedefined`, and `what`
+> "l" -- `currentline`
+> "t" -- `istailcall`
+> "u" -- `nups`, `nparams`, and `isvararg`
+> "f" -- `func`
+> "L" -- `activelines`
getlocal
function debug.getlocal(thread: thread, f: integer|fun(...any):...unknown, index: integer)
-> name: string
2. value: any
Returns the name and the value of the local variable with index local of the function at level f of the stack.
getmetatable
function debug.getmetatable(object: any)
-> metatable: table
Returns the metatable of the given value.
getregistry
function debug.getregistry()
-> table
Returns the registry table.
getupvalue
function debug.getupvalue(f: fun(...any):...unknown, up: integer)
-> name: string
2. value: any
Returns the name and the value of the upvalue with index up of the function.
getuservalue
function debug.getuservalue(u: userdata)
-> any
Returns the Lua value associated to u.
setcstacklimit
function debug.setcstacklimit(limit: integer)
-> boolean|integer
Deprecated in Lua 5.4.2
Sets a new limit for the C stack. This limit controls how deeply nested calls can go in Lua, with the intent of avoiding a stack overflow.
In case of success, this function returns the old limit. In case of error, it returns false.
setfenv
function debug.setfenv(object: <T>, env: table)
-> object: <T>
Sets the environment of the given object to the given table .
sethook
function debug.sethook(thread: thread, hook: fun(...any):...unknown, mask: string|"c"|"l"|"r", count?: integer)
Sets the given function as a hook.
mask:
+> "c" -- Calls hook when Lua calls a function.
+> "r" -- Calls hook when Lua returns from a function.
+> "l" -- Calls hook when Lua enters a new line of code.
setlocal
function debug.setlocal(thread: thread, level: integer, index: integer, value: any)
-> name: string
Assigns the value to the local variable with index local of the function at level of the stack.
setmetatable
function debug.setmetatable(value: <T>, meta?: table)
-> value: <T>
Sets the metatable for the given value to the given table (which can be nil).
setupvalue
function debug.setupvalue(f: fun(...any):...unknown, up: integer, value: any)
-> name: string
Assigns the value to the upvalue with index up of the function.
setuservalue
function debug.setuservalue(udata: userdata, value: any)
-> udata: userdata
Sets the given value as the Lua value associated to the given udata.
traceback
function debug.traceback(thread: thread, message?: any, level?: integer)
-> message: string
Returns a string with a traceback of the call stack. The optional message string is appended at the beginning of the traceback.
upvalueid
function debug.upvalueid(f: fun(...any):...unknown, n: integer)
-> id: lightuserdata
Returns a unique identifier (as a light userdata) for the upvalue numbered n from the given function.
upvaluejoin
function debug.upvaluejoin(f1: fun(...any):...unknown, n1: integer, f2: fun(...any):...unknown, n2: integer)
Make the n1-th upvalue of the Lua closure f1 refer to the n2-th upvalue of the Lua closure f2.
dofile
function dofile(filename?: string)
-> ...any
error
function error(message: any, level?: integer)
exitcode
false
ffi.VLA*
ffi.VLS*
ffi.cb*
free
(method) ffi.cb*:free()
set
(method) ffi.cb*:set(func: function)
ffi.cdata*
ffi.cdecl*
byte
function string.byte(s: string|number, i?: integer, j?: integer)
-> ...integer
Returns the internal numeric codes of the characters s[i], s[i+1], ..., s[j].
char
function string.char(byte: integer, ...integer)
-> string
Returns a string with length equal to the number of arguments, in which each character has the internal numeric code equal to its corresponding argument.
dump
function string.dump(f: fun(...any):...unknown, strip?: boolean)
-> string
Returns a string containing a binary representation (a binary chunk) of the given function.
find
function string.find(s: string|number, pattern: string|number, init?: integer, plain?: boolean)
-> start: integer|nil
2. end: integer|nil
3. ...any
Miss locale
@return start
@return end
@return ... — captured
format
function string.format(s: string|number, ...any)
-> string
Returns a formatted version of its variable number of arguments following the description given in its first argument.
gmatch
function string.gmatch(s: string|number, pattern: string|number)
-> fun():string, ...unknown
Miss locale
gsub
function string.gsub(s: string|number, pattern: string|number, repl: string|number|function|table, n?: integer)
-> string
2. count: integer
Miss locale
len
function string.len(s: string|number)
-> integer
Returns its length.
lower
function string.lower(s: string|number)
-> string
Returns a copy of this string with all uppercase letters changed to lowercase.
match
function string.match(s: string|number, pattern: string|number, init?: integer)
-> ...any
Miss locale
pack
function string.pack(fmt: string, v1: string|number, v2?: string|number, ...string|number)
-> binary: string
Miss locale
packsize
function string.packsize(fmt: string)
-> integer
Miss locale
rep
function string.rep(s: string|number, n: integer, sep?: string|number)
-> string
Returns a string that is the concatenation of n copies of the string s separated by the string sep.
reverse
function string.reverse(s: string|number)
-> string
Returns a string that is the string s reversed.
sub
function string.sub(s: string|number, i: integer, j?: integer)
-> string
Returns the substring of the string that starts at i and continues until j.
unpack
function string.unpack(fmt: string, s: string, pos?: integer)
-> ...any
2. offset: integer
Returns the values packed in string according to the format string fmt (see §6.4.2) .
upper
function string.upper(s: string|number)
-> string
Returns a copy of this string with all lowercase letters changed to uppercase.
ffi.ct*
ffi.ctype*
ffi.namespace*
[string]
function
ffilib
C
ffi.namespace*
abi
function ffilib.abi(param: string)
-> status: boolean
alignof
function ffilib.alignof(ct: ffi.cdata*|ffi.cdecl*|ffi.ctype*)
-> align: integer
arch
string
cast
function ffilib.cast(ct: ffi.cdata*|ffi.cdecl*|ffi.ctype*, init: any)
-> cdata: ffi.cdata*
cdef
function ffilib.cdef(def: string, params?: any, ...any)
copy
function ffilib.copy(dst: any, src: any, len: integer)
errno
function ffilib.errno(newerr?: integer)
-> err: integer
fill
function ffilib.fill(dst: any, len: integer, c?: any)
gc
function ffilib.gc(cdata: ffi.cdata*, finalizer?: function)
-> cdata: ffi.cdata*
istype
function ffilib.istype(ct: ffi.cdata*|ffi.cdecl*|ffi.ctype*, obj: any)
-> status: boolean
load
function ffilib.load(name: string, global?: boolean)
-> clib: ffi.namespace*
metatype
function ffilib.metatype(ct: ffi.cdata*|ffi.cdecl*|ffi.ctype*, metatable: table)
-> ctype: ffi.ctype*
new
function ffilib.new(ct: ffi.cdata*|ffi.cdecl*|ffi.ctype*, nelem?: integer, init?: any, ...any)
-> cdata: ffi.cdata*
offsetof
function ffilib.offsetof(ct: ffi.cdata*|ffi.cdecl*|ffi.ctype*, field: string)
-> ofs: integer
2. bpos: integer?
3. bsize: integer?
os
string
sizeof
function ffilib.sizeof(ct: ffi.cdata*|ffi.cdecl*|ffi.ctype*, nelem?: integer)
-> size: integer|nil
string
function ffilib.string(ptr: any, len?: integer)
-> str: string
typeof
function ffilib.typeof(ct: ffi.cdata*|ffi.cdecl*|ffi.ctype*, params?: any, ...any)
-> ctype: ffi.ctype*
file*
close
(method) file*:close()
-> suc: boolean?
2. exitcode: ("exit"|"signal")?
3. code: integer?
Close file.
exitcode:
| "exit"
| "signal"
flush
(method) file*:flush()
Saves any written data to file.
lines
(method) file*:lines(...string|integer|"*L"|"*a"|"*l"...(+1))
-> fun():any, ...unknown
for c in file:lines(...) do
body
end
...(param):
| "*n" -- Reads a numeral and returns it as number.
| "*a" -- Reads the whole file.
-> "*l" -- Reads the next line skipping the end of line.
| "*L" -- Reads the next line keeping the end of line.
read
(method) file*:read(...string|integer|"*L"|"*a"|"*l"...(+1))
-> any
2. ...any
Reads the file, according to the given formats, which specify what to read.
...(param):
| "*n" -- Reads a numeral and returns it as number.
| "*a" -- Reads the whole file.
-> "*l" -- Reads the next line skipping the end of line.
| "*L" -- Reads the next line keeping the end of line.
seek
(method) file*:seek(whence?: "cur"|"end"|"set", offset?: integer)
-> offset: integer
2. errmsg: string?
Sets and gets the file position, measured from the beginning of the file.
whence:
| "set" -- Base is beginning of the file.
-> "cur" -- Base is current position.
| "end" -- Base is end of file.
setvbuf
(method) file*:setvbuf(mode: "full"|"line"|"no", size?: integer)
Sets the buffering mode for an output file.
mode:
| "no" -- Output operation appears immediately.
| "full" -- Performed only when the buffer is full.
| "line" -- Buffered until a newline is output.
write
(method) file*:write(...string|number)
-> file*?
2. errmsg: string?
Writes the value of each of its arguments to file.
filetype
function
gcoptions
geometer
table
geometer.Editor
unknown
geometer.EditorState
unknown
geometer.MapGeneratorState
unknown
geometer.Modification
unknown
geometer.PrefabEditorState
unknown
geometer.Tool
unknown
geometer.assetPath
string
geometer.path
unknown
geometer.require
function geometer.require(p: any)
-> unknown
2. nil
getfenv
function getfenv(f?: integer|fun(...any):...unknown)
-> table
getmetatable
function getmetatable(object: any)
-> metatable: table
hookmask
infowhat
integer
io
iolib
io.close
function io.close(file?: file*)
-> suc: boolean?
2. exitcode: ("exit"|"signal")?
3. code: integer?
io.flush
function io.flush()
io.input
function io.input(file: string|file*)
io.lines
function io.lines(filename?: string, ...string|integer|"*L"|"*a"|"*l"...(+1))
-> fun():any, ...unknown
io.open
function io.open(filename: string, mode?: "a"|"a+"|"a+b"|"ab"|"r"...(+7))
-> file*?
2. errmsg: string?
io.output
function io.output(file: string|file*)
io.popen
function io.popen(prog: string, mode?: "r"|"w")
-> file*?
2. errmsg: string?
io.read
function io.read(...string|integer|"*L"|"*a"|"*l"...(+1))
-> any
2. ...any
io.tmpfile
function io.tmpfile()
-> file*
io.type
function io.type(file: file*)
-> "closed file"|"file"|`nil`
io.write
function io.write(...any)
-> file*
2. errmsg: string?
iolib
close
function io.close(file?: file*)
-> suc: boolean?
2. exitcode: ("exit"|"signal")?
3. code: integer?
Close file or default output file.
exitcode:
| "exit"
| "signal"
flush
function io.flush()
Saves any written data to default output file.
input
function io.input(file: string|file*)
Sets file as the default input file.
lines
function io.lines(filename?: string, ...string|integer|"*L"|"*a"|"*l"...(+1))
-> fun():any, ...unknown
for c in io.lines(filename, ...) do
body
end
...(param):
| "*n" -- Reads a numeral and returns it as number.
| "*a" -- Reads the whole file.
-> "*l" -- Reads the next line skipping the end of line.
| "*L" -- Reads the next line keeping the end of line.
open
function io.open(filename: string, mode?: "a"|"a+"|"a+b"|"ab"|"r"...(+7))
-> file*?
2. errmsg: string?
Opens a file, in the mode specified in the string mode.
mode:
-> "r" -- Read mode.
| "w" -- Write mode.
| "a" -- Append mode.
| "r+" -- Update mode, all previous data is preserved.
| "w+" -- Update mode, all previous data is erased.
| "a+" -- Append update mode, previous data is preserved, writing is only allowed at the end of file.
| "rb" -- Read mode. (in binary mode.)
| "wb" -- Write mode. (in binary mode.)
| "ab" -- Append mode. (in binary mode.)
| "r+b" -- Update mode, all previous data is preserved. (in binary mode.)
| "w+b" -- Update mode, all previous data is erased. (in binary mode.)
| "a+b" -- Append update mode, previous data is preserved, writing is only allowed at the end of file. (in binary mode.)
output
function io.output(file: string|file*)
Sets file as the default output file.
popen
function io.popen(prog: string, mode?: "r"|"w")
-> file*?
2. errmsg: string?
Starts program prog in a separated process.
mode:
| "r" -- Read data from this program by `file`.
| "w" -- Write data to this program by `file`.
read
function io.read(...string|integer|"*L"|"*a"|"*l"...(+1))
-> any
2. ...any
Reads the file, according to the given formats, which specify what to read.
...(param):
| "*n" -- Reads a numeral and returns it as number.
| "*a" -- Reads the whole file.
-> "*l" -- Reads the next line skipping the end of line.
| "*L" -- Reads the next line keeping the end of line.
stderr
file*
standard error.
stdin
file*
standard input.
stdout
file*
standard output.
tmpfile
function io.tmpfile()
-> file*
In case of success, returns a handle for a temporary file.
type
function io.type(file: file*)
-> "closed file"|"file"|`nil`
Checks whether obj is a valid file handle.
return #1:
| "file" -- Is an open file handle.
| "closed file" -- Is a closed file handle.
| `nil` -- Is not a file handle.
write
function io.write(...any)
-> file*
2. errmsg: string?
Writes the value of each of its arguments to default output file.
ipairs
function ipairs(t: <T:table>)
-> fun(table: <V>[], i?: integer):integer, <V>
2. <T:table>
3. i: integer
jit
jitlib
jit.flush
function jit.flush(func: boolean|function, recursive?: boolean)
jit.funcinfo.c
ffid
integer|nil
jit.funcinfo.lua
jit.off
function jit.off(func: boolean|function, recursive?: boolean)
jit.on
function jit.on(func: boolean|function, recursive?: boolean)
jit.opt
table
jit.opt.start
function jit.opt.start(...any)
jit.snap
jit.status
function jit.status()
-> status: boolean
2. ...string
jit.traceinfo
jitlib
arch
string|'arm'|'arm64'|'arm64be'|'mips'...(+8)
flush
function jit.flush(func: boolean|function, recursive?: boolean)
off
function jit.off(func: boolean|function, recursive?: boolean)
on
function jit.on(func: boolean|function, recursive?: boolean)
opt
table
os
'BSD'|'Linux'|'OSX'|'Other'|'POSIX'...(+1)
status
function jit.status()
-> status: boolean
2. ...string
version
string
version_num
number
lightuserdata
load
function load(chunk: string|function, chunkname?: string, mode?: "b"|"bt"|"t", env?: table)
-> function?
2. error_message: string?
loadfile
function loadfile(filename?: string, mode?: "b"|"bt"|"t", env?: table)
-> function?
2. error_message: string?
loadmode
loadstring
function loadstring(text: string, chunkname?: string)
-> function?
2. error_message: string?
localecategory
love
audio
love.audio
Provides an interface to create noise with the user's speakers.
conf
function love.conf(t: any)
data
love.data
Provides functionality for creating and transforming data.
event
love.event
Manages events, like keypresses.
filesystem
love.filesystem
Provides an interface to the user's filesystem.
font
love.font
Allows you to work with fonts.
getVersion
function love.getVersion()
-> major: number
2. minor: number
3. revision: number
4. codename: string
Gets the current running version of LÖVE.
@return major — The major version of LÖVE, i.e. 0 for version 0.9.1.
@return minor — The minor version of LÖVE, i.e. 9 for version 0.9.1.
@return revision — The revision version of LÖVE, i.e. 1 for version 0.9.1.
@return codename — The codename of the current version, i.e. 'Baby Inspector' for version 0.9.1.
graphics
love.graphics
The primary responsibility for the love.graphics module is the drawing of lines, shapes, text, Images and other Drawable objects onto the screen. Its secondary responsibilities include loading external files (including Images and Fonts) into memory, creating specialized objects (such as ParticleSystems or Canvases) and managing screen geometry.
LÖVE's coordinate system is rooted in the upper-left corner of the screen, which is at location (0, 0). The x axis is horizontal: larger values are further to the right. The y axis is vertical: larger values are further towards the bottom.
In many cases, you draw images or shapes in terms of their upper-left corner.
Many of the functions are used to manipulate the graphics coordinate system, which is essentially the way coordinates are mapped to the display. You can change the position, scale, and even rotation in this way.
hasDeprecationOutput
function love.hasDeprecationOutput()
-> enabled: boolean
Gets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise.
When deprecation output is enabled, the first use of a formally deprecated LÖVE API will show a message at the bottom of the screen for a short time, and print the message to the console.
@return enabled — Whether deprecation output is enabled.
image
love.image
Provides an interface to decode encoded image data.
isVersionCompatible
function love.isVersionCompatible(version: string)
-> compatible: boolean
Gets whether the given version is compatible with the current running version of LÖVE.
@param version — The version to check (for example '11.3' or '0.10.2').
@return compatible — Whether the given version is compatible with the current running version of LÖVE.
joystick
love.joystick
Provides an interface to the user's joystick.
keyboard
love.keyboard
Provides an interface to the user's keyboard.
math
love.math
Provides system-independent mathematical functions.
mouse
love.mouse
Provides an interface to the user's mouse.
physics
love.physics
Can simulate 2D rigid body physics in a realistic manner. This module is based on Box2D, and this API corresponds to the Box2D API as closely as possible.
setDeprecationOutput
function love.setDeprecationOutput(enable: boolean)
Sets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise.
When deprecation output is enabled, the first use of a formally deprecated LÖVE API will show a message at the bottom of the screen for a short time, and print the message to the console.
@param enable — Whether to enable or disable deprecation output.
sound
love.sound
This module is responsible for decoding sound files. It can't play the sounds, see love.audio for that.
system
love.system
Provides access to information about the user's system.
thread
love.thread
Allows you to work with threads.
Threads are separate Lua environments, running in parallel to the main code. As their code runs separately, they can be used to compute complex operations without adversely affecting the frame rate of the main thread. However, as they are separate environments, they cannot access the variables and functions of the main thread, and communication between threads is limited.
All LOVE objects (userdata) are shared among threads so you'll only have to send their references across threads. You may run into concurrency issues if you manipulate an object on multiple threads at the same time.
When a Thread is started, it only loads the love.thread module. Every other module has to be loaded with require.
timer
love.timer
Provides an interface to the user's clock.
touch
love.touch
Provides an interface to touch-screen presses.
video
love.video
This module is responsible for decoding, controlling, and streaming video files.
It can't draw the videos, see love.graphics.newVideo and Video objects for that.
window
love.window
Provides an interface for modifying and retrieving information about the program's window.
love
love
love.AlignMode
love.ArcType
love.AreaSpreadDistribution
love.BezierCurve
evaluate
(method) love.BezierCurve:evaluate(t: number)
-> x: number
2. y: number
Evaluate Bézier curve at parameter t. The parameter must be between 0 and 1 (inclusive).
This function can be used to move objects along paths or tween parameters. However it should not be used to render the curve, see BezierCurve:render for that purpose.
@param t — Where to evaluate the curve.
@return x — x coordinate of the curve at parameter t.
@return y — y coordinate of the curve at parameter t.
getControlPoint
(method) love.BezierCurve:getControlPoint(i: number)
-> x: number
2. y: number
Get coordinates of the i-th control point. Indices start with 1.
@param i — Index of the control point.
@return x — Position of the control point along the x axis.
@return y — Position of the control point along the y axis.
getControlPointCount
(method) love.BezierCurve:getControlPointCount()
-> count: number
Get the number of control points in the Bézier curve.
@return count — The number of control points.
getDegree
(method) love.BezierCurve:getDegree()
-> degree: number
Get degree of the Bézier curve. The degree is equal to number-of-control-points - 1.
@return degree — Degree of the Bézier curve.
getDerivative
(method) love.BezierCurve:getDerivative()
-> derivative: love.BezierCurve
Get the derivative of the Bézier curve.
This function can be used to rotate sprites moving along a curve in the direction of the movement and compute the direction perpendicular to the curve at some parameter t.
@return derivative — The derivative curve.
getSegment
(method) love.BezierCurve:getSegment(startpoint: number, endpoint: number)
-> curve: love.BezierCurve
Gets a BezierCurve that corresponds to the specified segment of this BezierCurve.
@param startpoint — The starting point along the curve. Must be between 0 and 1.
@param endpoint — The end of the segment. Must be between 0 and 1.
@return curve — A BezierCurve that corresponds to the specified segment.
insertControlPoint
(method) love.BezierCurve:insertControlPoint(x: number, y: number, i?: number)
Insert control point as the new i-th control point. Existing control points from i onwards are pushed back by 1. Indices start with 1. Negative indices wrap around: -1 is the last control point, -2 the one before the last, etc.
@param x — Position of the control point along the x axis.
@param y — Position of the control point along the y axis.
@param i — Index of the control point.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
removeControlPoint
(method) love.BezierCurve:removeControlPoint(index: number)
Removes the specified control point.
@param index — The index of the control point to remove.
render
(method) love.BezierCurve:render(depth?: number)
-> coordinates: table
Get a list of coordinates to be used with love.graphics.line.
This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.
If you are just interested to know the position on the curve given a parameter, use BezierCurve:evaluate.
@param depth — Number of recursive subdivision steps.
@return coordinates — List of x,y-coordinate pairs of points on the curve.
renderSegment
(method) love.BezierCurve:renderSegment(startpoint: number, endpoint: number, depth?: number)
-> coordinates: table
Get a list of coordinates on a specific part of the curve, to be used with love.graphics.line.
This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.
If you are just need to know the position on the curve given a parameter, use BezierCurve:evaluate.
@param startpoint — The starting point along the curve. Must be between 0 and 1.
@param endpoint — The end of the segment to render. Must be between 0 and 1.
@param depth — Number of recursive subdivision steps.
@return coordinates — List of x,y-coordinate pairs of points on the specified part of the curve.
rotate
(method) love.BezierCurve:rotate(angle: number, ox?: number, oy?: number)
Rotate the Bézier curve by an angle.
@param angle — Rotation angle in radians.
@param ox — X coordinate of the rotation center.
@param oy — Y coordinate of the rotation center.
scale
(method) love.BezierCurve:scale(s: number, ox?: number, oy?: number)
Scale the Bézier curve by a factor.
@param s — Scale factor.
@param ox — X coordinate of the scaling center.
@param oy — Y coordinate of the scaling center.
setControlPoint
(method) love.BezierCurve:setControlPoint(i: number, x: number, y: number)
Set coordinates of the i-th control point. Indices start with 1.
@param i — Index of the control point.
@param x — Position of the control point along the x axis.
@param y — Position of the control point along the y axis.
translate
(method) love.BezierCurve:translate(dx: number, dy: number)
Move the Bézier curve by an offset.
@param dx — Offset along the x axis.
@param dy — Offset along the y axis.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.BlendAlphaMode
love.BlendMode
love.Body
applyAngularImpulse
(method) love.Body:applyAngularImpulse(impulse: number)
Applies an angular impulse to a body. This makes a single, instantaneous addition to the body momentum.
A body with with a larger mass will react less. The reaction does '''not''' depend on the timestep, and is equivalent to applying a force continuously for 1 second. Impulses are best used to give a single push to a body. For a continuous push to a body it is better to use Body:applyForce.
@param impulse — The impulse in kilogram-square meter per second.
applyForce
(method) love.Body:applyForce(fx: number, fy: number)
Apply force to a Body.
A force pushes a body in a direction. A body with with a larger mass will react less. The reaction also depends on how long a force is applied: since the force acts continuously over the entire timestep, a short timestep will only push the body for a short time. Thus forces are best used for many timesteps to give a continuous push to a body (like gravity). For a single push that is independent of timestep, it is better to use Body:applyLinearImpulse.
If the position to apply the force is not given, it will act on the center of mass of the body. The part of the force not directed towards the center of mass will cause the body to spin (and depends on the rotational inertia).
Note that the force components and position must be given in world coordinates.
@param fx — The x component of force to apply to the center of mass.
@param fy — The y component of force to apply to the center of mass.
applyLinearImpulse
(method) love.Body:applyLinearImpulse(ix: number, iy: number)
Applies an impulse to a body.
This makes a single, instantaneous addition to the body momentum.
An impulse pushes a body in a direction. A body with with a larger mass will react less. The reaction does '''not''' depend on the timestep, and is equivalent to applying a force continuously for 1 second. Impulses are best used to give a single push to a body. For a continuous push to a body it is better to use Body:applyForce.
If the position to apply the impulse is not given, it will act on the center of mass of the body. The part of the impulse not directed towards the center of mass will cause the body to spin (and depends on the rotational inertia).
Note that the impulse components and position must be given in world coordinates.
@param ix — The x component of the impulse applied to the center of mass.
@param iy — The y component of the impulse applied to the center of mass.
applyTorque
(method) love.Body:applyTorque(torque: number)
Apply torque to a body.
Torque is like a force that will change the angular velocity (spin) of a body. The effect will depend on the rotational inertia a body has.
@param torque — The torque to apply.
destroy
(method) love.Body:destroy()
Explicitly destroys the Body and all fixtures and joints attached to it.
An error will occur if you attempt to use the object after calling this function. In 0.7.2, when you don't have time to wait for garbage collection, this function may be used to free the object immediately.
getAngle
(method) love.Body:getAngle()
-> angle: number
Get the angle of the body.
The angle is measured in radians. If you need to transform it to degrees, use math.deg.
A value of 0 radians will mean 'looking to the right'. Although radians increase counter-clockwise, the y axis points down so it becomes ''clockwise'' from our point of view.
@return angle — The angle in radians.
getAngularDamping
(method) love.Body:getAngularDamping()
-> damping: number
Gets the Angular damping of the Body
The angular damping is the ''rate of decrease of the angular velocity over time'': A spinning body with no damping and no external forces will continue spinning indefinitely. A spinning body with damping will gradually stop spinning.
Damping is not the same as friction - they can be modelled together. However, only damping is provided by Box2D (and LOVE).
Damping parameters should be between 0 and infinity, with 0 meaning no damping, and infinity meaning full damping. Normally you will use a damping value between 0 and 0.1.
@return damping — The value of the angular damping.
getAngularVelocity
(method) love.Body:getAngularVelocity()
-> w: number
Get the angular velocity of the Body.
The angular velocity is the ''rate of change of angle over time''.
It is changed in World:update by applying torques, off centre forces/impulses, and angular damping. It can be set directly with Body:setAngularVelocity.
If you need the ''rate of change of position over time'', use Body:getLinearVelocity.
@return w — The angular velocity in radians/second.
getContacts
(method) love.Body:getContacts()
-> contacts: table
Gets a list of all Contacts attached to the Body.
@return contacts — A list with all contacts associated with the Body.
getFixtures
(method) love.Body:getFixtures()
-> fixtures: table
Returns a table with all fixtures.
@return fixtures — A sequence with all fixtures.
getGravityScale
(method) love.Body:getGravityScale()
-> scale: number
Returns the gravity scale factor.
@return scale — The gravity scale factor.
getInertia
(method) love.Body:getInertia()
-> inertia: number
Gets the rotational inertia of the body.
The rotational inertia is how hard is it to make the body spin.
@return inertia — The rotational inertial of the body.
getJoints
(method) love.Body:getJoints()
-> joints: table
Returns a table containing the Joints attached to this Body.
@return joints — A sequence with the Joints attached to the Body.
getLinearDamping
(method) love.Body:getLinearDamping()
-> damping: number
Gets the linear damping of the Body.
The linear damping is the ''rate of decrease of the linear velocity over time''. A moving body with no damping and no external forces will continue moving indefinitely, as is the case in space. A moving body with damping will gradually stop moving.
Damping is not the same as friction - they can be modelled together.
@return damping — The value of the linear damping.
getLinearVelocity
(method) love.Body:getLinearVelocity()
-> x: number
2. y: number
Gets the linear velocity of the Body from its center of mass.
The linear velocity is the ''rate of change of position over time''.
If you need the ''rate of change of angle over time'', use Body:getAngularVelocity.
If you need to get the linear velocity of a point different from the center of mass:
-
Body:getLinearVelocityFromLocalPoint allows you to specify the point in local coordinates.
-
Body:getLinearVelocityFromWorldPoint allows you to specify the point in world coordinates.
See page 136 of 'Essential Mathematics for Games and Interactive Applications' for definitions of local and world coordinates.
@return x — The x-component of the velocity vector
@return y — The y-component of the velocity vector
getLinearVelocityFromLocalPoint
(method) love.Body:getLinearVelocityFromLocalPoint(x: number, y: number)
-> vx: number
2. vy: number
Get the linear velocity of a point on the body.
The linear velocity for a point on the body is the velocity of the body center of mass plus the velocity at that point from the body spinning.
The point on the body must given in local coordinates. Use Body:getLinearVelocityFromWorldPoint to specify this with world coordinates.
@param x — The x position to measure velocity.
@param y — The y position to measure velocity.
@return vx — The x component of velocity at point (x,y).
@return vy — The y component of velocity at point (x,y).
getLinearVelocityFromWorldPoint
(method) love.Body:getLinearVelocityFromWorldPoint(x: number, y: number)
-> vx: number
2. vy: number
Get the linear velocity of a point on the body.
The linear velocity for a point on the body is the velocity of the body center of mass plus the velocity at that point from the body spinning.
The point on the body must given in world coordinates. Use Body:getLinearVelocityFromLocalPoint to specify this with local coordinates.
@param x — The x position to measure velocity.
@param y — The y position to measure velocity.
@return vx — The x component of velocity at point (x,y).
@return vy — The y component of velocity at point (x,y).
getLocalCenter
(method) love.Body:getLocalCenter()
-> x: number
2. y: number
Get the center of mass position in local coordinates.
Use Body:getWorldCenter to get the center of mass in world coordinates.
@return x — The x coordinate of the center of mass.
@return y — The y coordinate of the center of mass.
getLocalPoint
(method) love.Body:getLocalPoint(worldX: number, worldY: number)
-> localX: number
2. localY: number
Transform a point from world coordinates to local coordinates.
@param worldX — The x position in world coordinates.
@param worldY — The y position in world coordinates.
@return localX — The x position in local coordinates.
@return localY — The y position in local coordinates.
getLocalPoints
(method) love.Body:getLocalPoints(x1: number, y1: number, x2: number, y2: number, ...number)
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Transforms multiple points from world coordinates to local coordinates.
@param x1 — (Argument) The x position of the first point.
@param y1 — (Argument) The y position of the first point.
@param x2 — (Argument) The x position of the second point.
@param y2 — (Argument) The y position of the second point.
@return x1 — (Result) The transformed x position of the first point.
@return y1 — (Result) The transformed y position of the first point.
@return x2 — (Result) The transformed x position of the second point.
@return y2 — (Result) The transformed y position of the second point.
getLocalVector
(method) love.Body:getLocalVector(worldX: number, worldY: number)
-> localX: number
2. localY: number
Transform a vector from world coordinates to local coordinates.
@param worldX — The vector x component in world coordinates.
@param worldY — The vector y component in world coordinates.
@return localX — The vector x component in local coordinates.
@return localY — The vector y component in local coordinates.
getMass
(method) love.Body:getMass()
-> mass: number
Get the mass of the body.
Static bodies always have a mass of 0.
@return mass — The mass of the body (in kilograms).
getMassData
(method) love.Body:getMassData()
-> x: number
2. y: number
3. mass: number
4. inertia: number
Returns the mass, its center, and the rotational inertia.
@return x — The x position of the center of mass.
@return y — The y position of the center of mass.
@return mass — The mass of the body.
@return inertia — The rotational inertia.
getPosition
(method) love.Body:getPosition()
-> x: number
2. y: number
Get the position of the body.
Note that this may not be the center of mass of the body.
@return x — The x position.
@return y — The y position.
getTransform
(method) love.Body:getTransform()
-> x: number
2. y: number
3. angle: number
Get the position and angle of the body.
Note that the position may not be the center of mass of the body. An angle of 0 radians will mean 'looking to the right'. Although radians increase counter-clockwise, the y axis points down so it becomes clockwise from our point of view.
@return x — The x component of the position.
@return y — The y component of the position.
@return angle — The angle in radians.
getType
(method) love.Body:getType()
-> type: "dynamic"|"kinematic"|"static"
Returns the type of the body.
@return type — The body type.
--
-- The types of a Body.
--
--
-- [Open in Browser](https://love2d.org/wiki/BodyType)
--
type:
| "static" -- Static bodies do not move.
| "dynamic" -- Dynamic bodies collide with all bodies.
| "kinematic" -- Kinematic bodies only collide with dynamic bodies.
getUserData
(method) love.Body:getUserData()
-> value: any
Returns the Lua value associated with this Body.
@return value — The Lua value associated with the Body.
getWorld
(method) love.Body:getWorld()
-> world: love.World
Gets the World the body lives in.
@return world — The world the body lives in.
getWorldCenter
(method) love.Body:getWorldCenter()
-> x: number
2. y: number
Get the center of mass position in world coordinates.
Use Body:getLocalCenter to get the center of mass in local coordinates.
@return x — The x coordinate of the center of mass.
@return y — The y coordinate of the center of mass.
getWorldPoint
(method) love.Body:getWorldPoint(localX: number, localY: number)
-> worldX: number
2. worldY: number
Transform a point from local coordinates to world coordinates.
@param localX — The x position in local coordinates.
@param localY — The y position in local coordinates.
@return worldX — The x position in world coordinates.
@return worldY — The y position in world coordinates.
getWorldPoints
(method) love.Body:getWorldPoints(x1: number, y1: number, x2: number, y2: number)
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Transforms multiple points from local coordinates to world coordinates.
@param x1 — The x position of the first point.
@param y1 — The y position of the first point.
@param x2 — The x position of the second point.
@param y2 — The y position of the second point.
@return x1 — The transformed x position of the first point.
@return y1 — The transformed y position of the first point.
@return x2 — The transformed x position of the second point.
@return y2 — The transformed y position of the second point.
getWorldVector
(method) love.Body:getWorldVector(localX: number, localY: number)
-> worldX: number
2. worldY: number
Transform a vector from local coordinates to world coordinates.
@param localX — The vector x component in local coordinates.
@param localY — The vector y component in local coordinates.
@return worldX — The vector x component in world coordinates.
@return worldY — The vector y component in world coordinates.
getX
(method) love.Body:getX()
-> x: number
Get the x position of the body in world coordinates.
@return x — The x position in world coordinates.
getY
(method) love.Body:getY()
-> y: number
Get the y position of the body in world coordinates.
@return y — The y position in world coordinates.
isActive
(method) love.Body:isActive()
-> status: boolean
Returns whether the body is actively used in the simulation.
@return status — True if the body is active or false if not.
isAwake
(method) love.Body:isAwake()
-> status: boolean
Returns the sleep status of the body.
@return status — True if the body is awake or false if not.
isBullet
(method) love.Body:isBullet()
-> status: boolean
Get the bullet status of a body.
There are two methods to check for body collisions:
-
at their location when the world is updated (default)
-
using continuous collision detection (CCD)
The default method is efficient, but a body moving very quickly may sometimes jump over another body without producing a collision. A body that is set as a bullet will use CCD. This is less efficient, but is guaranteed not to jump when moving quickly.
Note that static bodies (with zero mass) always use CCD, so your walls will not let a fast moving body pass through even if it is not a bullet.
@return status — The bullet status of the body.
isDestroyed
(method) love.Body:isDestroyed()
-> destroyed: boolean
Gets whether the Body is destroyed. Destroyed bodies cannot be used.
@return destroyed — Whether the Body is destroyed.
isFixedRotation
(method) love.Body:isFixedRotation()
-> fixed: boolean
Returns whether the body rotation is locked.
@return fixed — True if the body's rotation is locked or false if not.
isSleepingAllowed
(method) love.Body:isSleepingAllowed()
-> allowed: boolean
Returns the sleeping behaviour of the body.
@return allowed — True if the body is allowed to sleep or false if not.
isTouching
(method) love.Body:isTouching(otherbody: love.Body)
-> touching: boolean
Gets whether the Body is touching the given other Body.
@param otherbody — The other body to check.
@return touching — True if this body is touching the other body, false otherwise.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
resetMassData
(method) love.Body:resetMassData()
Resets the mass of the body by recalculating it from the mass properties of the fixtures.
setActive
(method) love.Body:setActive(active: boolean)
Sets whether the body is active in the world.
An inactive body does not take part in the simulation. It will not move or cause any collisions.
@param active — If the body is active or not.
setAngle
(method) love.Body:setAngle(angle: number)
Set the angle of the body.
The angle is measured in radians. If you need to transform it from degrees, use math.rad.
A value of 0 radians will mean 'looking to the right'. Although radians increase counter-clockwise, the y axis points down so it becomes ''clockwise'' from our point of view.
It is possible to cause a collision with another body by changing its angle.
@param angle — The angle in radians.
setAngularDamping
(method) love.Body:setAngularDamping(damping: number)
Sets the angular damping of a Body
See Body:getAngularDamping for a definition of angular damping.
Angular damping can take any value from 0 to infinity. It is recommended to stay between 0 and 0.1, though. Other values will look unrealistic.
@param damping — The new angular damping.
setAngularVelocity
(method) love.Body:setAngularVelocity(w: number)
Sets the angular velocity of a Body.
The angular velocity is the ''rate of change of angle over time''.
This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost.
@param w — The new angular velocity, in radians per second
setAwake
(method) love.Body:setAwake(awake: boolean)
Wakes the body up or puts it to sleep.
@param awake — The body sleep status.
setBullet
(method) love.Body:setBullet(status: boolean)
Set the bullet status of a body.
There are two methods to check for body collisions:
-
at their location when the world is updated (default)
-
using continuous collision detection (CCD)
The default method is efficient, but a body moving very quickly may sometimes jump over another body without producing a collision. A body that is set as a bullet will use CCD. This is less efficient, but is guaranteed not to jump when moving quickly.
Note that static bodies (with zero mass) always use CCD, so your walls will not let a fast moving body pass through even if it is not a bullet.
@param status — The bullet status of the body.
setFixedRotation
(method) love.Body:setFixedRotation(isFixed: boolean)
Set whether a body has fixed rotation.
Bodies with fixed rotation don't vary the speed at which they rotate. Calling this function causes the mass to be reset.
@param isFixed — Whether the body should have fixed rotation.
setGravityScale
(method) love.Body:setGravityScale(scale: number)
Sets a new gravity scale factor for the body.
@param scale — The new gravity scale factor.
setInertia
(method) love.Body:setInertia(inertia: number)
Set the inertia of a body.
@param inertia — The new moment of inertia, in kilograms * pixel squared.
setLinearDamping
(method) love.Body:setLinearDamping(ld: number)
Sets the linear damping of a Body
See Body:getLinearDamping for a definition of linear damping.
Linear damping can take any value from 0 to infinity. It is recommended to stay between 0 and 0.1, though. Other values will make the objects look 'floaty'(if gravity is enabled).
@param ld — The new linear damping
setLinearVelocity
(method) love.Body:setLinearVelocity(x: number, y: number)
Sets a new linear velocity for the Body.
This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost.
@param x — The x-component of the velocity vector.
@param y — The y-component of the velocity vector.
setMass
(method) love.Body:setMass(mass: number)
Sets a new body mass.
@param mass — The mass, in kilograms.
setMassData
(method) love.Body:setMassData(x: number, y: number, mass: number, inertia: number)
Overrides the calculated mass data.
@param x — The x position of the center of mass.
@param y — The y position of the center of mass.
@param mass — The mass of the body.
@param inertia — The rotational inertia.
setPosition
(method) love.Body:setPosition(x: number, y: number)
Set the position of the body.
Note that this may not be the center of mass of the body.
This function cannot wake up the body.
@param x — The x position.
@param y — The y position.
setSleepingAllowed
(method) love.Body:setSleepingAllowed(allowed: boolean)
Sets the sleeping behaviour of the body. Should sleeping be allowed, a body at rest will automatically sleep. A sleeping body is not simulated unless it collided with an awake body. Be wary that one can end up with a situation like a floating sleeping body if the floor was removed.
@param allowed — True if the body is allowed to sleep or false if not.
setTransform
(method) love.Body:setTransform(x: number, y: number, angle: number)
Set the position and angle of the body.
Note that the position may not be the center of mass of the body. An angle of 0 radians will mean 'looking to the right'. Although radians increase counter-clockwise, the y axis points down so it becomes clockwise from our point of view.
This function cannot wake up the body.
@param x — The x component of the position.
@param y — The y component of the position.
@param angle — The angle in radians.
setType
(method) love.Body:setType(type: "dynamic"|"kinematic"|"static")
Sets a new body type.
@param type — The new type.
--
-- The types of a Body.
--
--
-- [Open in Browser](https://love2d.org/wiki/BodyType)
--
type:
| "static" -- Static bodies do not move.
| "dynamic" -- Dynamic bodies collide with all bodies.
| "kinematic" -- Kinematic bodies only collide with dynamic bodies.
setUserData
(method) love.Body:setUserData(value: any)
Associates a Lua value with the Body.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Body.
setX
(method) love.Body:setX(x: number)
Set the x position of the body.
This function cannot wake up the body.
@param x — The x position.
setY
(method) love.Body:setY(y: number)
Set the y position of the body.
This function cannot wake up the body.
@param y — The y position.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.BodyType
love.BufferMode
love.ByteData
clone
(method) love.Data:clone()
-> clone: love.Data
Creates a new copy of the Data object.
@return clone — The new copy.
getFFIPointer
(method) love.Data:getFFIPointer()
-> pointer: ffi.cdata*
Gets an FFI pointer to the Data.
This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.
@return pointer — A raw void* pointer to the Data, or nil if FFI is unavailable.
getPointer
(method) love.Data:getPointer()
-> pointer: lightuserdata
Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
@return pointer — A raw pointer to the Data.
getSize
(method) love.Data:getSize()
-> size: number
Gets the Data's size in bytes.
@return size — The size of the Data in bytes.
getString
(method) love.Data:getString()
-> data: string
Gets the full Data as a string.
@return data — The raw data.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Canvas
generateMipmaps
(method) love.Canvas:generateMipmaps()
Generates mipmaps for the Canvas, based on the contents of the highest-resolution mipmap level.
The Canvas must be created with mipmaps set to a MipmapMode other than 'none' for this function to work. It should only be called while the Canvas is not the active render target.
If the mipmap mode is set to 'auto', this function is automatically called inside love.graphics.setCanvas when switching from this Canvas to another Canvas or to the main screen.
getDPIScale
(method) love.Texture:getDPIScale()
-> dpiscale: number
Gets the DPI scale factor of the Texture.
The DPI scale factor represents relative pixel density. A DPI scale factor of 2 means the texture has twice the pixel density in each dimension (4 times as many pixels in the same area) compared to a texture with a DPI scale factor of 1.
For example, a texture with pixel dimensions of 100x100 with a DPI scale factor of 2 will be drawn as if it was 50x50. This is useful with high-dpi / retina displays to easily allow swapping out higher or lower pixel density Images and Canvases without needing any extra manual scaling logic.
@return dpiscale — The DPI scale factor of the Texture.
getDepth
(method) love.Texture:getDepth()
-> depth: number
Gets the depth of a Volume Texture. Returns 1 for 2D, Cubemap, and Array textures.
@return depth — The depth of the volume Texture.
getDepthSampleMode
(method) love.Texture:getDepthSampleMode()
-> compare: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3)
Gets the comparison mode used when sampling from a depth texture in a shader.
Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D.
@return compare — The comparison mode used when sampling from this texture in a shader, or nil if setDepthSampleMode has not been called on this Texture.
--
-- Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompareMode)
--
compare:
| "equal" -- * stencil tests: the stencil value of the pixel must be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.
| "notequal" -- * stencil tests: the stencil value of the pixel must not be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel.
| "less" -- * stencil tests: the stencil value of the pixel must be less than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.
| "lequal" -- * stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.
| "gequal" -- * stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.
| "greater" -- * stencil tests: the stencil value of the pixel must be greater than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.
| "never" -- Objects will never be drawn.
| "always" -- Objects will always be drawn. Effectively disables the depth or stencil test.
getDimensions
(method) love.Texture:getDimensions()
-> width: number
2. height: number
Gets the width and height of the Texture.
@return width — The width of the Texture.
@return height — The height of the Texture.
getFilter
(method) love.Texture:getFilter()
-> min: "linear"|"nearest"
2. mag: "linear"|"nearest"
3. anisotropy: number
Gets the filter mode of the Texture.
@return min — Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels).
@return mag — Filter mode to use when magnifying the texture (rendering it at a smaller size on-screen than its size in pixels).
@return anisotropy — Maximum amount of anisotropic filtering used.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
getFormat
(method) love.Texture:getFormat()
-> format: "ASTC10x10"|"ASTC10x5"|"ASTC10x6"|"ASTC10x8"|"ASTC12x10"...(+59)
Gets the pixel format of the Texture.
@return format — The pixel format the Texture was created with.
--
-- Pixel formats for Textures, ImageData, and CompressedImageData.
--
--
-- [Open in Browser](https://love2d.org/wiki/PixelFormat)
--
format:
| "unknown" -- Indicates unknown pixel format, used internally.
| "normal" -- Alias for rgba8, or srgba8 if gamma-correct rendering is enabled.
| "hdr" -- A format suitable for high dynamic range content - an alias for the rgba16f format, normally.
| "r8" -- Single-channel (red component) format (8 bpp).
| "rg8" -- Two channels (red and green components) with 8 bits per channel (16 bpp).
| "rgba8" -- 8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders).
| "srgba8" -- gamma-correct version of rgba8.
| "r16" -- Single-channel (red component) format (16 bpp).
| "rg16" -- Two channels (red and green components) with 16 bits per channel (32 bpp).
| "rgba16" -- 16 bits per channel (64 bpp) RGBA. Color channel values range from 0-65535 (0-1 in shaders).
| "r16f" -- Floating point single-channel format (16 bpp). Color values can range from [-65504, +65504].
| "rg16f" -- Floating point two-channel format with 16 bits per channel (32 bpp). Color values can range from [-65504, +65504].
| "rgba16f" -- Floating point RGBA with 16 bits per channel (64 bpp). Color values can range from [-65504, +65504].
| "r32f" -- Floating point single-channel format (32 bpp).
| "rg32f" -- Floating point two-channel format with 32 bits per channel (64 bpp).
| "rgba32f" -- Floating point RGBA with 32 bits per channel (128 bpp).
| "la8" -- Same as rg8, but accessed as (L, L, L, A)
| "rgba4" -- 4 bits per channel (16 bpp) RGBA.
| "rgb5a1" -- RGB with 5 bits each, and a 1-bit alpha channel (16 bpp).
| "rgb565" -- RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format.
| "rgb10a2" -- RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp).
| "rg11b10f" -- Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp). There is no alpha channel. Color values can range from [0, +65024].
| "stencil8" -- No depth buffer and 8-bit stencil buffer.
| "depth16" -- 16-bit depth buffer and no stencil buffer.
| "depth24" -- 24-bit depth buffer and no stencil buffer.
| "depth32f" -- 32-bit float depth buffer and no stencil buffer.
| "depth24stencil8" -- 24-bit depth buffer and 8-bit stencil buffer.
| "depth32fstencil8" -- 32-bit float depth buffer and 8-bit stencil buffer.
| "DXT1" -- The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems.
| "DXT3" -- The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.
| "DXT5" -- The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems.
| "BC4" -- The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
| "BC4s" -- The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "BC5" -- The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
| "BC5s" -- The signed variant of the BC5 format.
| "BC6h" -- The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems.
| "BC6hs" -- The signed variant of the BC6H format. Stores RGB data in the range of +65504.
| "BC7" -- The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.
| "ETC1" -- The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.
| "ETC2rgb" -- The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.
| "ETC2rgba" -- The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.
| "ETC2rgba1" -- The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.
| "EACr" -- The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.
| "EACrs" -- The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "EACrg" -- The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.
| "EACrgs" -- The signed two-channel variant of the EAC format.
| "PVR1rgb2" -- The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized.
| "PVR1rgb4" -- The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.
| "PVR1rgba2" -- The 2 bit per pixel RGBA variant of the PVRTC1 format.
| "PVR1rgba4" -- The 4 bit per pixel RGBA variant of the PVRTC1 format.
| "ASTC4x4" -- The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.
| "ASTC5x4" -- The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.
| "ASTC5x5" -- The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.
| "ASTC6x5" -- The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.
| "ASTC6x6" -- The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.
| "ASTC8x5" -- The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.
| "ASTC8x6" -- The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.
| "ASTC8x8" -- The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.
| "ASTC10x5" -- The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.
| "ASTC10x6" -- The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.
| "ASTC10x8" -- The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.
| "ASTC10x10" -- The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.
| "ASTC12x10" -- The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.
| "ASTC12x12" -- The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.
getHeight
(method) love.Texture:getHeight()
-> height: number
Gets the height of the Texture.
@return height — The height of the Texture.
getLayerCount
(method) love.Texture:getLayerCount()
-> layers: number
Gets the number of layers / slices in an Array Texture. Returns 1 for 2D, Cubemap, and Volume textures.
@return layers — The number of layers in the Array Texture.
getMSAA
(method) love.Canvas:getMSAA()
-> samples: number
Gets the number of multisample antialiasing (MSAA) samples used when drawing to the Canvas.
This may be different than the number used as an argument to love.graphics.newCanvas if the system running LÖVE doesn't support that number.
@return samples — The number of multisample antialiasing samples used by the canvas when drawing to it.
getMipmapCount
(method) love.Texture:getMipmapCount()
-> mipmaps: number
Gets the number of mipmaps contained in the Texture. If the texture was not created with mipmaps, it will return 1.
@return mipmaps — The number of mipmaps in the Texture.
getMipmapFilter
(method) love.Texture:getMipmapFilter()
-> mode: "linear"|"nearest"
2. sharpness: number
Gets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images.
@return mode — The filter mode used in between mipmap levels. nil if mipmap filtering is not enabled.
@return sharpness — Value used to determine whether the image should use more or less detailed mipmap levels than normal when drawing.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mode:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
getMipmapMode
(method) love.Canvas:getMipmapMode()
-> mode: "auto"|"manual"|"none"
Gets the MipmapMode this Canvas was created with.
@return mode — The mipmap mode this Canvas was created with.
--
-- Controls whether a Canvas has mipmaps, and its behaviour when it does.
--
--
-- [Open in Browser](https://love2d.org/wiki/MipmapMode)
--
mode:
| "none" -- The Canvas has no mipmaps.
| "auto" -- The Canvas has mipmaps. love.graphics.setCanvas can be used to render to a specific mipmap level, or Canvas:generateMipmaps can (re-)compute all mipmap levels based on the base level.
| "manual" -- The Canvas has mipmaps, and all mipmap levels will automatically be recomputed when switching away from the Canvas with love.graphics.setCanvas.
getPixelDimensions
(method) love.Texture:getPixelDimensions()
-> pixelwidth: number
2. pixelheight: number
Gets the width and height in pixels of the Texture.
Texture:getDimensions gets the dimensions of the texture in units scaled by the texture's DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelDimensions only when dealing specifically with pixels, for example when using Canvas:newImageData.
@return pixelwidth — The width of the Texture, in pixels.
@return pixelheight — The height of the Texture, in pixels.
getPixelHeight
(method) love.Texture:getPixelHeight()
-> pixelheight: number
Gets the height in pixels of the Texture.
DPI scale factor, rather than pixels. Use getHeight for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelHeight only when dealing specifically with pixels, for example when using Canvas:newImageData.
@return pixelheight — The height of the Texture, in pixels.
getPixelWidth
(method) love.Texture:getPixelWidth()
-> pixelwidth: number
Gets the width in pixels of the Texture.
DPI scale factor, rather than pixels. Use getWidth for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelWidth only when dealing specifically with pixels, for example when using Canvas:newImageData.
@return pixelwidth — The width of the Texture, in pixels.
getTextureType
(method) love.Texture:getTextureType()
-> texturetype: "2d"|"array"|"cube"|"volume"
Gets the type of the Texture.
@return texturetype — The type of the Texture.
--
-- Types of textures (2D, cubemap, etc.)
--
--
-- [Open in Browser](https://love2d.org/wiki/TextureType)
--
texturetype:
| "2d" -- Regular 2D texture with width and height.
| "array" -- Several same-size 2D textures organized into a single object. Similar to a texture atlas / sprite sheet, but avoids sprite bleeding and other issues.
| "cube" -- Cubemap texture with 6 faces. Requires a custom shader (and Shader:send) to use. Sampling from a cube texture in a shader takes a 3D direction vector instead of a texture coordinate.
| "volume" -- 3D texture with width, height, and depth. Requires a custom shader to use. Volume textures can have texture filtering applied along the 3rd axis.
getWidth
(method) love.Texture:getWidth()
-> width: number
Gets the width of the Texture.
@return width — The width of the Texture.
getWrap
(method) love.Texture:getWrap()
-> horiz: "clamp"|"clampzero"|"mirroredrepeat"|"repeat"
2. vert: "clamp"|"clampzero"|"mirroredrepeat"|"repeat"
3. depth: "clamp"|"clampzero"|"mirroredrepeat"|"repeat"
Gets the wrapping properties of a Texture.
This function returns the currently set horizontal and vertical wrapping modes for the texture.
@return horiz — Horizontal wrapping mode of the texture.
@return vert — Vertical wrapping mode of the texture.
@return depth — Wrapping mode for the z-axis of a Volume texture.
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
horiz:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
vert:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
depth:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
isReadable
(method) love.Texture:isReadable()
-> readable: boolean
Gets whether the Texture can be drawn and sent to a Shader.
Canvases created with stencil and/or depth PixelFormats are not readable by default, unless readable=true is specified in the settings table passed into love.graphics.newCanvas.
Non-readable Canvases can still be rendered to.
@return readable — Whether the Texture is readable.
newImageData
(method) love.Canvas:newImageData()
-> data: love.ImageData
Generates ImageData from the contents of the Canvas.
@return data — The new ImageData made from the Canvas' contents.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
renderTo
(method) love.Canvas:renderTo(func: function)
Render to the Canvas using a function.
This is a shortcut to love.graphics.setCanvas:
canvas:renderTo( func )
is the same as
love.graphics.setCanvas( canvas )
func()
love.graphics.setCanvas()
@param func — A function performing drawing operations.
setDepthSampleMode
(method) love.Texture:setDepthSampleMode(compare: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3))
Sets the comparison mode used when sampling from a depth texture in a shader. Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D.
When using a depth texture with a comparison mode set in a shader, it must be declared as a sampler2DShadow and used in a GLSL 3 Shader. The result of accessing the texture in the shader will return a float between 0 and 1, proportional to the number of samples (up to 4 samples will be used if bilinear filtering is enabled) that passed the test set by the comparison operation.
Depth texture comparison can only be used with readable depth-formatted Canvases.
@param compare — The comparison mode used when sampling from this texture in a shader.
--
-- Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompareMode)
--
compare:
| "equal" -- * stencil tests: the stencil value of the pixel must be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.
| "notequal" -- * stencil tests: the stencil value of the pixel must not be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel.
| "less" -- * stencil tests: the stencil value of the pixel must be less than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.
| "lequal" -- * stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.
| "gequal" -- * stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.
| "greater" -- * stencil tests: the stencil value of the pixel must be greater than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.
| "never" -- Objects will never be drawn.
| "always" -- Objects will always be drawn. Effectively disables the depth or stencil test.
setFilter
(method) love.Texture:setFilter(min: "linear"|"nearest", mag?: "linear"|"nearest", anisotropy?: number)
Sets the filter mode of the Texture.
@param min — Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels).
@param mag — Filter mode to use when magnifying the texture (rendering it at a larger size on-screen than its size in pixels).
@param anisotropy — Maximum amount of anisotropic filtering to use.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
setMipmapFilter
(method) love.Texture:setMipmapFilter(filtermode: "linear"|"nearest", sharpness?: number)
Sets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images.
Mipmapping is useful when drawing a texture at a reduced scale. It can improve performance and reduce aliasing issues.
In created with the mipmaps flag enabled for the mipmap filter to have any effect. In versions prior to 0.10.0 it's best to call this method directly after creating the image with love.graphics.newImage, to avoid bugs in certain graphics drivers.
Due to hardware restrictions and driver bugs, in versions prior to 0.10.0 images that weren't loaded from a CompressedData must have power-of-two dimensions (64x64, 512x256, etc.) to use mipmaps.
@param filtermode — The filter mode to use in between mipmap levels. 'nearest' will often give better performance.
@param sharpness — A positive sharpness value makes the texture use a more detailed mipmap level when drawing, at the expense of performance. A negative value does the reverse.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
filtermode:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
setWrap
(method) love.Texture:setWrap(horiz: "clamp"|"clampzero"|"mirroredrepeat"|"repeat", vert?: "clamp"|"clampzero"|"mirroredrepeat"|"repeat", depth?: "clamp"|"clampzero"|"mirroredrepeat"|"repeat")
Sets the wrapping properties of a Texture.
This function sets the way a Texture is repeated when it is drawn with a Quad that is larger than the texture's extent, or when a custom Shader is used which uses texture coordinates outside of [0, 1]. A texture may be clamped or set to repeat in both horizontal and vertical directions.
Clamped textures appear only once (with the edges of the texture stretching to fill the extent of the Quad), whereas repeated ones repeat as many times as there is room in the Quad.
@param horiz — Horizontal wrapping mode of the texture.
@param vert — Vertical wrapping mode of the texture.
@param depth — Wrapping mode for the z-axis of a Volume texture.
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
horiz:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
vert:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
depth:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.ChainShape
computeAABB
(method) love.Shape:computeAABB(tx: number, ty: number, tr: number, childIndex?: number)
-> topLeftX: number
2. topLeftY: number
3. bottomRightX: number
4. bottomRightY: number
Returns the points of the bounding box for the transformed shape.
@param tx — The translation of the shape on the x-axis.
@param ty — The translation of the shape on the y-axis.
@param tr — The shape rotation.
@param childIndex — The index of the child to compute the bounding box of.
@return topLeftX — The x position of the top-left point.
@return topLeftY — The y position of the top-left point.
@return bottomRightX — The x position of the bottom-right point.
@return bottomRightY — The y position of the bottom-right point.
computeMass
(method) love.Shape:computeMass(density: number)
-> x: number
2. y: number
3. mass: number
4. inertia: number
Computes the mass properties for the shape with the specified density.
@param density — The shape density.
@return x — The x postition of the center of mass.
@return y — The y postition of the center of mass.
@return mass — The mass of the shape.
@return inertia — The rotational inertia.
getChildCount
(method) love.Shape:getChildCount()
-> count: number
Returns the number of children the shape has.
@return count — The number of children.
getChildEdge
(method) love.ChainShape:getChildEdge(index: number)
-> shape: love.EdgeShape
Returns a child of the shape as an EdgeShape.
@param index — The index of the child.
@return shape — The child as an EdgeShape.
getNextVertex
(method) love.ChainShape:getNextVertex()
-> x: number
2. y: number
Gets the vertex that establishes a connection to the next shape.
Setting next and previous ChainShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.
@return x — The x-component of the vertex, or nil if ChainShape:setNextVertex hasn't been called.
@return y — The y-component of the vertex, or nil if ChainShape:setNextVertex hasn't been called.
getPoint
(method) love.ChainShape:getPoint(index: number)
-> x: number
2. y: number
Returns a point of the shape.
@param index — The index of the point to return.
@return x — The x-coordinate of the point.
@return y — The y-coordinate of the point.
getPoints
(method) love.ChainShape:getPoints()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Returns all points of the shape.
@return x1 — The x-coordinate of the first point.
@return y1 — The y-coordinate of the first point.
@return x2 — The x-coordinate of the second point.
@return y2 — The y-coordinate of the second point.
getPreviousVertex
(method) love.ChainShape:getPreviousVertex()
-> x: number
2. y: number
Gets the vertex that establishes a connection to the previous shape.
Setting next and previous ChainShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.
@return x — The x-component of the vertex, or nil if ChainShape:setPreviousVertex hasn't been called.
@return y — The y-component of the vertex, or nil if ChainShape:setPreviousVertex hasn't been called.
getRadius
(method) love.Shape:getRadius()
-> radius: number
Gets the radius of the shape.
@return radius — The radius of the shape.
getType
(method) love.Shape:getType()
-> type: "chain"|"circle"|"edge"|"polygon"
Gets a string representing the Shape.
This function can be useful for conditional debug drawing.
@return type — The type of the Shape.
--
-- The different types of Shapes, as returned by Shape:getType.
--
--
-- [Open in Browser](https://love2d.org/wiki/ShapeType)
--
type:
| "circle" -- The Shape is a CircleShape.
| "polygon" -- The Shape is a PolygonShape.
| "edge" -- The Shape is a EdgeShape.
| "chain" -- The Shape is a ChainShape.
getVertexCount
(method) love.ChainShape:getVertexCount()
-> count: number
Returns the number of vertices the shape has.
@return count — The number of vertices.
rayCast
(method) love.Shape:rayCast(x1: number, y1: number, x2: number, y2: number, maxFraction: number, tx: number, ty: number, tr: number, childIndex?: number)
-> xn: number
2. yn: number
3. fraction: number
Casts a ray against the shape and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned. The Shape can be transformed to get it into the desired position.
The ray starts on the first point of the input line and goes towards the second point of the line. The fourth argument is the maximum distance the ray is going to travel as a scale factor of the input line length.
The childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children.
The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.
hitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction
@param x1 — The x position of the input line starting point.
@param y1 — The y position of the input line starting point.
@param x2 — The x position of the input line end point.
@param y2 — The y position of the input line end point.
@param maxFraction — Ray length parameter.
@param tx — The translation of the shape on the x-axis.
@param ty — The translation of the shape on the y-axis.
@param tr — The shape rotation.
@param childIndex — The index of the child the ray gets cast against.
@return xn — The x component of the normal vector of the edge where the ray hit the shape.
@return yn — The y component of the normal vector of the edge where the ray hit the shape.
@return fraction — The position on the input line where the intersection happened as a factor of the line length.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setNextVertex
(method) love.ChainShape:setNextVertex(x: number, y: number)
Sets a vertex that establishes a connection to the next shape.
This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.
@param x — The x-component of the vertex.
@param y — The y-component of the vertex.
setPreviousVertex
(method) love.ChainShape:setPreviousVertex(x: number, y: number)
Sets a vertex that establishes a connection to the previous shape.
This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.
@param x — The x-component of the vertex.
@param y — The y-component of the vertex.
testPoint
(method) love.Shape:testPoint(tx: number, ty: number, tr: number, x: number, y: number)
-> hit: boolean
This is particularly useful for mouse interaction with the shapes. By looping through all shapes and testing the mouse position with this function, we can find which shapes the mouse touches.
@param tx — Translates the shape along the x-axis.
@param ty — Translates the shape along the y-axis.
@param tr — Rotates the shape.
@param x — The x-component of the point.
@param y — The y-component of the point.
@return hit — True if inside, false if outside
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Channel
clear
(method) love.Channel:clear()
Clears all the messages in the Channel queue.
demand
(method) love.Channel:demand()
-> value: any
Retrieves the value of a Channel message and removes it from the message queue.
It waits until a message is in the queue then returns the message value.
@return value — The contents of the message.
getCount
(method) love.Channel:getCount()
-> count: number
Retrieves the number of messages in the thread Channel queue.
@return count — The number of messages in the queue.
hasRead
(method) love.Channel:hasRead(id: number)
-> hasread: boolean
Gets whether a pushed value has been popped or otherwise removed from the Channel.
@param id — An id value previously returned by Channel:push.
@return hasread — Whether the value represented by the id has been removed from the Channel via Channel:pop, Channel:demand, or Channel:clear.
peek
(method) love.Channel:peek()
-> value: any
Retrieves the value of a Channel message, but leaves it in the queue.
It returns nil if there's no message in the queue.
@return value — The contents of the message.
performAtomic
(method) love.Channel:performAtomic(func: function, arg1: any, ...any)
-> ret1: any
Executes the specified function atomically with respect to this Channel.
Calling multiple methods in a row on the same Channel is often useful. However if multiple Threads are calling this Channel's methods at the same time, the different calls on each Thread might end up interleaved (e.g. one or more of the second thread's calls may happen in between the first thread's calls.)
This method avoids that issue by making sure the Thread calling the method has exclusive access to the Channel until the specified function has returned.
@param func — The function to call, the form of function(channel, arg1, arg2, ...) end. The Channel is passed as the first argument to the function when it is called.
@param arg1 — Additional arguments that the given function will receive when it is called.
@return ret1 — The first return value of the given function (if any.)
pop
(method) love.Channel:pop()
-> value: any
Retrieves the value of a Channel message and removes it from the message queue.
It returns nil if there are no messages in the queue.
@return value — The contents of the message.
push
(method) love.Channel:push(value: any)
-> id: number
Send a message to the thread Channel.
See Variant for the list of supported types.
@param value — The contents of the message.
@return id — Identifier which can be supplied to Channel:hasRead
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
supply
(method) love.Channel:supply(value: any)
-> success: boolean
Send a message to the thread Channel and wait for a thread to accept it.
See Variant for the list of supported types.
@param value — The contents of the message.
@return success — Whether the message was successfully supplied (always true).
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.CircleShape
computeAABB
(method) love.Shape:computeAABB(tx: number, ty: number, tr: number, childIndex?: number)
-> topLeftX: number
2. topLeftY: number
3. bottomRightX: number
4. bottomRightY: number
Returns the points of the bounding box for the transformed shape.
@param tx — The translation of the shape on the x-axis.
@param ty — The translation of the shape on the y-axis.
@param tr — The shape rotation.
@param childIndex — The index of the child to compute the bounding box of.
@return topLeftX — The x position of the top-left point.
@return topLeftY — The y position of the top-left point.
@return bottomRightX — The x position of the bottom-right point.
@return bottomRightY — The y position of the bottom-right point.
computeMass
(method) love.Shape:computeMass(density: number)
-> x: number
2. y: number
3. mass: number
4. inertia: number
Computes the mass properties for the shape with the specified density.
@param density — The shape density.
@return x — The x postition of the center of mass.
@return y — The y postition of the center of mass.
@return mass — The mass of the shape.
@return inertia — The rotational inertia.
getChildCount
(method) love.Shape:getChildCount()
-> count: number
Returns the number of children the shape has.
@return count — The number of children.
getPoint
(method) love.CircleShape:getPoint()
-> x: number
2. y: number
Gets the center point of the circle shape.
@return x — The x-component of the center point of the circle.
@return y — The y-component of the center point of the circle.
getRadius
(method) love.CircleShape:getRadius()
-> radius: number
Gets the radius of the circle shape.
@return radius — The radius of the circle
getType
(method) love.Shape:getType()
-> type: "chain"|"circle"|"edge"|"polygon"
Gets a string representing the Shape.
This function can be useful for conditional debug drawing.
@return type — The type of the Shape.
--
-- The different types of Shapes, as returned by Shape:getType.
--
--
-- [Open in Browser](https://love2d.org/wiki/ShapeType)
--
type:
| "circle" -- The Shape is a CircleShape.
| "polygon" -- The Shape is a PolygonShape.
| "edge" -- The Shape is a EdgeShape.
| "chain" -- The Shape is a ChainShape.
rayCast
(method) love.Shape:rayCast(x1: number, y1: number, x2: number, y2: number, maxFraction: number, tx: number, ty: number, tr: number, childIndex?: number)
-> xn: number
2. yn: number
3. fraction: number
Casts a ray against the shape and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned. The Shape can be transformed to get it into the desired position.
The ray starts on the first point of the input line and goes towards the second point of the line. The fourth argument is the maximum distance the ray is going to travel as a scale factor of the input line length.
The childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children.
The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.
hitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction
@param x1 — The x position of the input line starting point.
@param y1 — The y position of the input line starting point.
@param x2 — The x position of the input line end point.
@param y2 — The y position of the input line end point.
@param maxFraction — Ray length parameter.
@param tx — The translation of the shape on the x-axis.
@param ty — The translation of the shape on the y-axis.
@param tr — The shape rotation.
@param childIndex — The index of the child the ray gets cast against.
@return xn — The x component of the normal vector of the edge where the ray hit the shape.
@return yn — The y component of the normal vector of the edge where the ray hit the shape.
@return fraction — The position on the input line where the intersection happened as a factor of the line length.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setPoint
(method) love.CircleShape:setPoint(x: number, y: number)
Sets the location of the center of the circle shape.
@param x — The x-component of the new center point of the circle.
@param y — The y-component of the new center point of the circle.
setRadius
(method) love.CircleShape:setRadius(radius: number)
Sets the radius of the circle.
@param radius — The radius of the circle
testPoint
(method) love.Shape:testPoint(tx: number, ty: number, tr: number, x: number, y: number)
-> hit: boolean
This is particularly useful for mouse interaction with the shapes. By looping through all shapes and testing the mouse position with this function, we can find which shapes the mouse touches.
@param tx — Translates the shape along the x-axis.
@param ty — Translates the shape along the y-axis.
@param tr — Rotates the shape.
@param x — The x-component of the point.
@param y — The y-component of the point.
@return hit — True if inside, false if outside
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.CompareMode
love.CompressedData
clone
(method) love.Data:clone()
-> clone: love.Data
Creates a new copy of the Data object.
@return clone — The new copy.
getFFIPointer
(method) love.Data:getFFIPointer()
-> pointer: ffi.cdata*
Gets an FFI pointer to the Data.
This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.
@return pointer — A raw void* pointer to the Data, or nil if FFI is unavailable.
getFormat
(method) love.CompressedData:getFormat()
-> format: "deflate"|"gzip"|"lz4"|"zlib"
Gets the compression format of the CompressedData.
@return format — The format of the CompressedData.
--
-- Compressed data formats.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompressedDataFormat)
--
format:
| "lz4" -- The LZ4 compression format. Compresses and decompresses very quickly, but the compression ratio is not the best. LZ4-HC is used when compression level 9 is specified. Some benchmarks are available here.
| "zlib" -- The zlib format is DEFLATE-compressed data with a small bit of header data. Compresses relatively slowly and decompresses moderately quickly, and has a decent compression ratio.
| "gzip" -- The gzip format is DEFLATE-compressed data with a slightly larger header than zlib. Since it uses DEFLATE it has the same compression characteristics as the zlib format.
| "deflate" -- Raw DEFLATE-compressed data (no header).
getPointer
(method) love.Data:getPointer()
-> pointer: lightuserdata
Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
@return pointer — A raw pointer to the Data.
getSize
(method) love.Data:getSize()
-> size: number
Gets the Data's size in bytes.
@return size — The size of the Data in bytes.
getString
(method) love.Data:getString()
-> data: string
Gets the full Data as a string.
@return data — The raw data.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.CompressedDataFormat
love.CompressedImageData
clone
(method) love.Data:clone()
-> clone: love.Data
Creates a new copy of the Data object.
@return clone — The new copy.
getDimensions
(method) love.CompressedImageData:getDimensions()
-> width: number
2. height: number
Gets the width and height of the CompressedImageData.
@return width — The width of the CompressedImageData.
@return height — The height of the CompressedImageData.
getFFIPointer
(method) love.Data:getFFIPointer()
-> pointer: ffi.cdata*
Gets an FFI pointer to the Data.
This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.
@return pointer — A raw void* pointer to the Data, or nil if FFI is unavailable.
getFormat
(method) love.CompressedImageData:getFormat()
-> format: "ASTC10x10"|"ASTC10x5"|"ASTC10x6"|"ASTC10x8"|"ASTC12x10"...(+31)
Gets the format of the CompressedImageData.
@return format — The format of the CompressedImageData.
--
-- Compressed image data formats. Here and here are a couple overviews of many of the formats.
--
-- Unlike traditional PNG or jpeg, these formats stay compressed in RAM and in the graphics card's VRAM. This is good for saving memory space as well as improving performance, since the graphics card will be able to keep more of the image's pixels in its fast-access cache when drawing it.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompressedImageFormat)
--
format:
| "DXT1" -- The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems.
| "DXT3" -- The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.
| "DXT5" -- The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems.
| "BC4" -- The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
| "BC4s" -- The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "BC5" -- The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
| "BC5s" -- The signed variant of the BC5 format.
| "BC6h" -- The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems.
| "BC6hs" -- The signed variant of the BC6H format. Stores RGB data in the range of +65504.
| "BC7" -- The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.
| "ETC1" -- The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.
| "ETC2rgb" -- The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.
| "ETC2rgba" -- The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.
| "ETC2rgba1" -- The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.
| "EACr" -- The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.
| "EACrs" -- The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "EACrg" -- The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.
| "EACrgs" -- The signed two-channel variant of the EAC format.
| "PVR1rgb2" -- The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized.
| "PVR1rgb4" -- The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.
| "PVR1rgba2" -- The 2 bit per pixel RGBA variant of the PVRTC1 format.
| "PVR1rgba4" -- The 4 bit per pixel RGBA variant of the PVRTC1 format.
| "ASTC4x4" -- The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.
| "ASTC5x4" -- The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.
| "ASTC5x5" -- The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.
| "ASTC6x5" -- The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.
| "ASTC6x6" -- The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.
| "ASTC8x5" -- The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.
| "ASTC8x6" -- The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.
| "ASTC8x8" -- The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.
| "ASTC10x5" -- The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.
| "ASTC10x6" -- The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.
| "ASTC10x8" -- The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.
| "ASTC10x10" -- The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.
| "ASTC12x10" -- The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.
| "ASTC12x12" -- The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.
getHeight
(method) love.CompressedImageData:getHeight()
-> height: number
Gets the height of the CompressedImageData.
@return height — The height of the CompressedImageData.
getMipmapCount
(method) love.CompressedImageData:getMipmapCount()
-> mipmaps: number
Gets the number of mipmap levels in the CompressedImageData. The base mipmap level (original image) is included in the count.
@return mipmaps — The number of mipmap levels stored in the CompressedImageData.
getPointer
(method) love.Data:getPointer()
-> pointer: lightuserdata
Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
@return pointer — A raw pointer to the Data.
getSize
(method) love.Data:getSize()
-> size: number
Gets the Data's size in bytes.
@return size — The size of the Data in bytes.
getString
(method) love.Data:getString()
-> data: string
Gets the full Data as a string.
@return data — The raw data.
getWidth
(method) love.CompressedImageData:getWidth()
-> width: number
Gets the width of the CompressedImageData.
@return width — The width of the CompressedImageData.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.CompressedImageFormat
love.Contact
getChildren
(method) love.Contact:getChildren()
-> indexA: number
2. indexB: number
Gets the child indices of the shapes of the two colliding fixtures. For ChainShapes, an index of 1 is the first edge in the chain. Used together with Fixture:rayCast or ChainShape:getChildEdge.
@return indexA — The child index of the first fixture's shape.
@return indexB — The child index of the second fixture's shape.
getFixtures
(method) love.Contact:getFixtures()
-> fixtureA: love.Fixture
2. fixtureB: love.Fixture
Gets the two Fixtures that hold the shapes that are in contact.
@return fixtureA — The first Fixture.
@return fixtureB — The second Fixture.
getFriction
(method) love.Contact:getFriction()
-> friction: number
Get the friction between two shapes that are in contact.
@return friction — The friction of the contact.
getNormal
(method) love.Contact:getNormal()
-> nx: number
2. ny: number
Get the normal vector between two shapes that are in contact.
This function returns the coordinates of a unit vector that points from the first shape to the second.
@return nx — The x component of the normal vector.
@return ny — The y component of the normal vector.
getPositions
(method) love.Contact:getPositions()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Returns the contact points of the two colliding fixtures. There can be one or two points.
@return x1 — The x coordinate of the first contact point.
@return y1 — The y coordinate of the first contact point.
@return x2 — The x coordinate of the second contact point.
@return y2 — The y coordinate of the second contact point.
getRestitution
(method) love.Contact:getRestitution()
-> restitution: number
Get the restitution between two shapes that are in contact.
@return restitution — The restitution between the two shapes.
isEnabled
(method) love.Contact:isEnabled()
-> enabled: boolean
Returns whether the contact is enabled. The collision will be ignored if a contact gets disabled in the preSolve callback.
@return enabled — True if enabled, false otherwise.
isTouching
(method) love.Contact:isTouching()
-> touching: boolean
Returns whether the two colliding fixtures are touching each other.
@return touching — True if they touch or false if not.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
resetFriction
(method) love.Contact:resetFriction()
Resets the contact friction to the mixture value of both fixtures.
resetRestitution
(method) love.Contact:resetRestitution()
Resets the contact restitution to the mixture value of both fixtures.
setEnabled
(method) love.Contact:setEnabled(enabled: boolean)
Enables or disables the contact.
@param enabled — True to enable or false to disable.
setFriction
(method) love.Contact:setFriction(friction: number)
Sets the contact friction.
@param friction — The contact friction.
setRestitution
(method) love.Contact:setRestitution(restitution: number)
Sets the contact restitution.
@param restitution — The contact restitution.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.ContainerType
love.CullMode
love.Cursor
getType
(method) love.Cursor:getType()
-> ctype: "arrow"|"crosshair"|"hand"|"ibeam"|"image"...(+8)
Gets the type of the Cursor.
@return ctype — The type of the Cursor.
--
-- Types of hardware cursors.
--
--
-- [Open in Browser](https://love2d.org/wiki/CursorType)
--
ctype:
| "image" -- The cursor is using a custom image.
| "arrow" -- An arrow pointer.
| "ibeam" -- An I-beam, normally used when mousing over editable or selectable text.
| "wait" -- Wait graphic.
| "waitarrow" -- Small wait cursor with an arrow pointer.
| "crosshair" -- Crosshair symbol.
| "sizenwse" -- Double arrow pointing to the top-left and bottom-right.
| "sizenesw" -- Double arrow pointing to the top-right and bottom-left.
| "sizewe" -- Double arrow pointing left and right.
| "sizens" -- Double arrow pointing up and down.
| "sizeall" -- Four-pointed arrow pointing up, down, left, and right.
| "no" -- Slashed circle or crossbones.
| "hand" -- Hand symbol.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.CursorType
love.Data
clone
(method) love.Data:clone()
-> clone: love.Data
Creates a new copy of the Data object.
@return clone — The new copy.
getFFIPointer
(method) love.Data:getFFIPointer()
-> pointer: ffi.cdata*
Gets an FFI pointer to the Data.
This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.
@return pointer — A raw void* pointer to the Data, or nil if FFI is unavailable.
getPointer
(method) love.Data:getPointer()
-> pointer: lightuserdata
Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
@return pointer — A raw pointer to the Data.
getSize
(method) love.Data:getSize()
-> size: number
Gets the Data's size in bytes.
@return size — The size of the Data in bytes.
getString
(method) love.Data:getString()
-> data: string
Gets the full Data as a string.
@return data — The raw data.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Decoder
clone
(method) love.Decoder:clone()
-> decoder: love.Decoder
Creates a new copy of current decoder.
The new decoder will start decoding from the beginning of the audio stream.
@return decoder — New copy of the decoder.
decode
(method) love.Decoder:decode()
-> soundData: love.SoundData
Decodes the audio and returns a SoundData object containing the decoded audio data.
@return soundData — Decoded audio data.
getBitDepth
(method) love.Decoder:getBitDepth()
-> bitDepth: number
Returns the number of bits per sample.
@return bitDepth — Either 8, or 16.
getChannelCount
(method) love.Decoder:getChannelCount()
-> channels: number
Returns the number of channels in the stream.
@return channels — 1 for mono, 2 for stereo.
getDuration
(method) love.Decoder:getDuration()
-> duration: number
Gets the duration of the sound file. It may not always be sample-accurate, and it may return -1 if the duration cannot be determined at all.
@return duration — The duration of the sound file in seconds, or -1 if it cannot be determined.
getSampleRate
(method) love.Decoder:getSampleRate()
-> rate: number
Returns the sample rate of the Decoder.
@return rate — Number of samples per second.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
seek
(method) love.Decoder:seek(offset: number)
Sets the currently playing position of the Decoder.
@param offset — The position to seek to, in seconds.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.DisplayOrientation
love.DistanceJoint
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getDampingRatio
(method) love.DistanceJoint:getDampingRatio()
-> ratio: number
Gets the damping ratio.
@return ratio — The damping ratio.
getFrequency
(method) love.DistanceJoint:getFrequency()
-> Hz: number
Gets the response speed.
@return Hz — The response speed.
getLength
(method) love.DistanceJoint:getLength()
-> l: number
Gets the equilibrium distance between the two Bodies.
@return l — The length between the two Bodies.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setDampingRatio
(method) love.DistanceJoint:setDampingRatio(ratio: number)
Sets the damping ratio.
@param ratio — The damping ratio.
setFrequency
(method) love.DistanceJoint:setFrequency(Hz: number)
Sets the response speed.
@param Hz — The response speed.
setLength
(method) love.DistanceJoint:setLength(l: number)
Sets the equilibrium distance between the two Bodies.
@param l — The length between the two Bodies.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.DistanceModel
love.DrawMode
love.Drawable
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.DroppedFile
close
(method) love.File:close()
-> success: boolean
Closes a File.
@return success — Whether closing was successful.
flush
(method) love.File:flush()
-> success: boolean
2. err: string
Flushes any buffered written data in the file to the disk.
@return success — Whether the file successfully flushed any buffered data to the disk.
@return err — The error string, if an error occurred and the file could not be flushed.
getBuffer
(method) love.File:getBuffer()
-> mode: "full"|"line"|"none"
2. size: number
Gets the buffer mode of a file.
@return mode — The current buffer mode of the file.
@return size — The maximum size in bytes of the file's buffer.
--
-- Buffer modes for File objects.
--
--
-- [Open in Browser](https://love2d.org/wiki/BufferMode)
--
mode:
| "none" -- No buffering. The result of write and append operations appears immediately.
| "line" -- Line buffering. Write and append operations are buffered until a newline is output or the buffer size limit is reached.
| "full" -- Full buffering. Write and append operations are always buffered until the buffer size limit is reached.
getFilename
(method) love.File:getFilename()
-> filename: string
Gets the filename that the File object was created with. If the file object originated from the love.filedropped callback, the filename will be the full platform-dependent file path.
@return filename — The filename of the File.
getMode
(method) love.File:getMode()
-> mode: "a"|"c"|"r"|"w"
Gets the FileMode the file has been opened with.
@return mode — The mode this file has been opened with.
--
-- The different modes you can open a File in.
--
--
-- [Open in Browser](https://love2d.org/wiki/FileMode)
--
mode:
| "r" -- Open a file for read.
| "w" -- Open a file for write.
| "a" -- Open a file for append.
| "c" -- Do not open a file (represents a closed file.)
getSize
(method) love.File:getSize()
-> size: number
Returns the file size.
@return size — The file size in bytes.
isEOF
(method) love.File:isEOF()
-> eof: boolean
Gets whether end-of-file has been reached.
@return eof — Whether EOF has been reached.
isOpen
(method) love.File:isOpen()
-> open: boolean
Gets whether the file is open.
@return open — True if the file is currently open, false otherwise.
lines
(method) love.File:lines()
-> iterator: function
Iterate over all the lines in a file.
@return iterator — The iterator (can be used in for loops).
open
(method) love.File:open(mode: "a"|"c"|"r"|"w")
-> ok: boolean
2. err: string
Open the file for write, read or append.
@param mode — The mode to open the file in.
@return ok — True on success, false otherwise.
@return err — The error string if an error occurred.
--
-- The different modes you can open a File in.
--
--
-- [Open in Browser](https://love2d.org/wiki/FileMode)
--
mode:
| "r" -- Open a file for read.
| "w" -- Open a file for write.
| "a" -- Open a file for append.
| "c" -- Do not open a file (represents a closed file.)
read
(method) love.File:read(bytes?: number)
-> contents: string
2. size: number
Read a number of bytes from a file.
@param bytes — The number of bytes to read.
@return contents — The contents of the read bytes.
@return size — How many bytes have been read.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
seek
(method) love.File:seek(pos: number)
-> success: boolean
Seek to a position in a file
@param pos — The position to seek to
@return success — Whether the operation was successful
setBuffer
(method) love.File:setBuffer(mode: "full"|"line"|"none", size?: number)
-> success: boolean
2. errorstr: string
Sets the buffer mode for a file opened for writing or appending. Files with buffering enabled will not write data to the disk until the buffer size limit is reached, depending on the buffer mode.
File:flush will force any buffered data to be written to the disk.
@param mode — The buffer mode to use.
@param size — The maximum size in bytes of the file's buffer.
@return success — Whether the buffer mode was successfully set.
@return errorstr — The error string, if the buffer mode could not be set and an error occurred.
--
-- Buffer modes for File objects.
--
--
-- [Open in Browser](https://love2d.org/wiki/BufferMode)
--
mode:
| "none" -- No buffering. The result of write and append operations appears immediately.
| "line" -- Line buffering. Write and append operations are buffered until a newline is output or the buffer size limit is reached.
| "full" -- Full buffering. Write and append operations are always buffered until the buffer size limit is reached.
tell
(method) love.File:tell()
-> pos: number
Returns the position in the file.
@return pos — The current position.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
write
(method) love.File:write(data: string, size?: number)
-> success: boolean
2. err: string
Write data to a file.
@param data — The string data to write.
@param size — How many bytes to write.
@return success — Whether the operation was successful.
@return err — The error string if an error occurred.
love.EdgeShape
computeAABB
(method) love.Shape:computeAABB(tx: number, ty: number, tr: number, childIndex?: number)
-> topLeftX: number
2. topLeftY: number
3. bottomRightX: number
4. bottomRightY: number
Returns the points of the bounding box for the transformed shape.
@param tx — The translation of the shape on the x-axis.
@param ty — The translation of the shape on the y-axis.
@param tr — The shape rotation.
@param childIndex — The index of the child to compute the bounding box of.
@return topLeftX — The x position of the top-left point.
@return topLeftY — The y position of the top-left point.
@return bottomRightX — The x position of the bottom-right point.
@return bottomRightY — The y position of the bottom-right point.
computeMass
(method) love.Shape:computeMass(density: number)
-> x: number
2. y: number
3. mass: number
4. inertia: number
Computes the mass properties for the shape with the specified density.
@param density — The shape density.
@return x — The x postition of the center of mass.
@return y — The y postition of the center of mass.
@return mass — The mass of the shape.
@return inertia — The rotational inertia.
getChildCount
(method) love.Shape:getChildCount()
-> count: number
Returns the number of children the shape has.
@return count — The number of children.
getNextVertex
(method) love.EdgeShape:getNextVertex()
-> x: number
2. y: number
Gets the vertex that establishes a connection to the next shape.
Setting next and previous EdgeShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.
@return x — The x-component of the vertex, or nil if EdgeShape:setNextVertex hasn't been called.
@return y — The y-component of the vertex, or nil if EdgeShape:setNextVertex hasn't been called.
getPoints
(method) love.EdgeShape:getPoints()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Returns the local coordinates of the edge points.
@return x1 — The x-component of the first vertex.
@return y1 — The y-component of the first vertex.
@return x2 — The x-component of the second vertex.
@return y2 — The y-component of the second vertex.
getPreviousVertex
(method) love.EdgeShape:getPreviousVertex()
-> x: number
2. y: number
Gets the vertex that establishes a connection to the previous shape.
Setting next and previous EdgeShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.
@return x — The x-component of the vertex, or nil if EdgeShape:setPreviousVertex hasn't been called.
@return y — The y-component of the vertex, or nil if EdgeShape:setPreviousVertex hasn't been called.
getRadius
(method) love.Shape:getRadius()
-> radius: number
Gets the radius of the shape.
@return radius — The radius of the shape.
getType
(method) love.Shape:getType()
-> type: "chain"|"circle"|"edge"|"polygon"
Gets a string representing the Shape.
This function can be useful for conditional debug drawing.
@return type — The type of the Shape.
--
-- The different types of Shapes, as returned by Shape:getType.
--
--
-- [Open in Browser](https://love2d.org/wiki/ShapeType)
--
type:
| "circle" -- The Shape is a CircleShape.
| "polygon" -- The Shape is a PolygonShape.
| "edge" -- The Shape is a EdgeShape.
| "chain" -- The Shape is a ChainShape.
rayCast
(method) love.Shape:rayCast(x1: number, y1: number, x2: number, y2: number, maxFraction: number, tx: number, ty: number, tr: number, childIndex?: number)
-> xn: number
2. yn: number
3. fraction: number
Casts a ray against the shape and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned. The Shape can be transformed to get it into the desired position.
The ray starts on the first point of the input line and goes towards the second point of the line. The fourth argument is the maximum distance the ray is going to travel as a scale factor of the input line length.
The childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children.
The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.
hitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction
@param x1 — The x position of the input line starting point.
@param y1 — The y position of the input line starting point.
@param x2 — The x position of the input line end point.
@param y2 — The y position of the input line end point.
@param maxFraction — Ray length parameter.
@param tx — The translation of the shape on the x-axis.
@param ty — The translation of the shape on the y-axis.
@param tr — The shape rotation.
@param childIndex — The index of the child the ray gets cast against.
@return xn — The x component of the normal vector of the edge where the ray hit the shape.
@return yn — The y component of the normal vector of the edge where the ray hit the shape.
@return fraction — The position on the input line where the intersection happened as a factor of the line length.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setNextVertex
(method) love.EdgeShape:setNextVertex(x: number, y: number)
Sets a vertex that establishes a connection to the next shape.
This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.
@param x — The x-component of the vertex.
@param y — The y-component of the vertex.
setPreviousVertex
(method) love.EdgeShape:setPreviousVertex(x: number, y: number)
Sets a vertex that establishes a connection to the previous shape.
This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.
@param x — The x-component of the vertex.
@param y — The y-component of the vertex.
testPoint
(method) love.Shape:testPoint(tx: number, ty: number, tr: number, x: number, y: number)
-> hit: boolean
This is particularly useful for mouse interaction with the shapes. By looping through all shapes and testing the mouse position with this function, we can find which shapes the mouse touches.
@param tx — Translates the shape along the x-axis.
@param ty — Translates the shape along the y-axis.
@param tr — Rotates the shape.
@param x — The x-component of the point.
@param y — The y-component of the point.
@return hit — True if inside, false if outside
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.EffectType
love.EffectWaveform
love.EncodeFormat
love.Event
love.File
close
(method) love.File:close()
-> success: boolean
Closes a File.
@return success — Whether closing was successful.
flush
(method) love.File:flush()
-> success: boolean
2. err: string
Flushes any buffered written data in the file to the disk.
@return success — Whether the file successfully flushed any buffered data to the disk.
@return err — The error string, if an error occurred and the file could not be flushed.
getBuffer
(method) love.File:getBuffer()
-> mode: "full"|"line"|"none"
2. size: number
Gets the buffer mode of a file.
@return mode — The current buffer mode of the file.
@return size — The maximum size in bytes of the file's buffer.
--
-- Buffer modes for File objects.
--
--
-- [Open in Browser](https://love2d.org/wiki/BufferMode)
--
mode:
| "none" -- No buffering. The result of write and append operations appears immediately.
| "line" -- Line buffering. Write and append operations are buffered until a newline is output or the buffer size limit is reached.
| "full" -- Full buffering. Write and append operations are always buffered until the buffer size limit is reached.
getFilename
(method) love.File:getFilename()
-> filename: string
Gets the filename that the File object was created with. If the file object originated from the love.filedropped callback, the filename will be the full platform-dependent file path.
@return filename — The filename of the File.
getMode
(method) love.File:getMode()
-> mode: "a"|"c"|"r"|"w"
Gets the FileMode the file has been opened with.
@return mode — The mode this file has been opened with.
--
-- The different modes you can open a File in.
--
--
-- [Open in Browser](https://love2d.org/wiki/FileMode)
--
mode:
| "r" -- Open a file for read.
| "w" -- Open a file for write.
| "a" -- Open a file for append.
| "c" -- Do not open a file (represents a closed file.)
getSize
(method) love.File:getSize()
-> size: number
Returns the file size.
@return size — The file size in bytes.
isEOF
(method) love.File:isEOF()
-> eof: boolean
Gets whether end-of-file has been reached.
@return eof — Whether EOF has been reached.
isOpen
(method) love.File:isOpen()
-> open: boolean
Gets whether the file is open.
@return open — True if the file is currently open, false otherwise.
lines
(method) love.File:lines()
-> iterator: function
Iterate over all the lines in a file.
@return iterator — The iterator (can be used in for loops).
open
(method) love.File:open(mode: "a"|"c"|"r"|"w")
-> ok: boolean
2. err: string
Open the file for write, read or append.
@param mode — The mode to open the file in.
@return ok — True on success, false otherwise.
@return err — The error string if an error occurred.
--
-- The different modes you can open a File in.
--
--
-- [Open in Browser](https://love2d.org/wiki/FileMode)
--
mode:
| "r" -- Open a file for read.
| "w" -- Open a file for write.
| "a" -- Open a file for append.
| "c" -- Do not open a file (represents a closed file.)
read
(method) love.File:read(bytes?: number)
-> contents: string
2. size: number
Read a number of bytes from a file.
@param bytes — The number of bytes to read.
@return contents — The contents of the read bytes.
@return size — How many bytes have been read.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
seek
(method) love.File:seek(pos: number)
-> success: boolean
Seek to a position in a file
@param pos — The position to seek to
@return success — Whether the operation was successful
setBuffer
(method) love.File:setBuffer(mode: "full"|"line"|"none", size?: number)
-> success: boolean
2. errorstr: string
Sets the buffer mode for a file opened for writing or appending. Files with buffering enabled will not write data to the disk until the buffer size limit is reached, depending on the buffer mode.
File:flush will force any buffered data to be written to the disk.
@param mode — The buffer mode to use.
@param size — The maximum size in bytes of the file's buffer.
@return success — Whether the buffer mode was successfully set.
@return errorstr — The error string, if the buffer mode could not be set and an error occurred.
--
-- Buffer modes for File objects.
--
--
-- [Open in Browser](https://love2d.org/wiki/BufferMode)
--
mode:
| "none" -- No buffering. The result of write and append operations appears immediately.
| "line" -- Line buffering. Write and append operations are buffered until a newline is output or the buffer size limit is reached.
| "full" -- Full buffering. Write and append operations are always buffered until the buffer size limit is reached.
tell
(method) love.File:tell()
-> pos: number
Returns the position in the file.
@return pos — The current position.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
write
(method) love.File:write(data: string, size?: number)
-> success: boolean
2. err: string
Write data to a file.
@param data — The string data to write.
@param size — How many bytes to write.
@return success — Whether the operation was successful.
@return err — The error string if an error occurred.
love.FileData
clone
(method) love.Data:clone()
-> clone: love.Data
Creates a new copy of the Data object.
@return clone — The new copy.
getExtension
(method) love.FileData:getExtension()
-> ext: string
Gets the extension of the FileData.
@return ext — The extension of the file the FileData represents.
getFFIPointer
(method) love.Data:getFFIPointer()
-> pointer: ffi.cdata*
Gets an FFI pointer to the Data.
This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.
@return pointer — A raw void* pointer to the Data, or nil if FFI is unavailable.
getFilename
(method) love.FileData:getFilename()
-> name: string
Gets the filename of the FileData.
@return name — The name of the file the FileData represents.
getPointer
(method) love.Data:getPointer()
-> pointer: lightuserdata
Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
@return pointer — A raw pointer to the Data.
getSize
(method) love.Data:getSize()
-> size: number
Gets the Data's size in bytes.
@return size — The size of the Data in bytes.
getString
(method) love.Data:getString()
-> data: string
Gets the full Data as a string.
@return data — The raw data.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.FileDecoder
love.FileMode
love.FileType
love.FilterMode
love.FilterType
love.Fixture
destroy
(method) love.Fixture:destroy()
Destroys the fixture.
getBody
(method) love.Fixture:getBody()
-> body: love.Body
Returns the body to which the fixture is attached.
@return body — The parent body.
getBoundingBox
(method) love.Fixture:getBoundingBox(index?: number)
-> topLeftX: number
2. topLeftY: number
3. bottomRightX: number
4. bottomRightY: number
Returns the points of the fixture bounding box. In case the fixture has multiple children a 1-based index can be specified. For example, a fixture will have multiple children with a chain shape.
@param index — A bounding box of the fixture.
@return topLeftX — The x position of the top-left point.
@return topLeftY — The y position of the top-left point.
@return bottomRightX — The x position of the bottom-right point.
@return bottomRightY — The y position of the bottom-right point.
getCategory
(method) love.Fixture:getCategory()
Returns the categories the fixture belongs to.
getDensity
(method) love.Fixture:getDensity()
-> density: number
Returns the density of the fixture.
@return density — The fixture density in kilograms per square meter.
getFilterData
(method) love.Fixture:getFilterData()
-> categories: number
2. mask: number
3. group: number
Returns the filter data of the fixture.
Categories and masks are encoded as the bits of a 16-bit integer.
@return categories — The categories as an integer from 0 to 65535.
@return mask — The mask as an integer from 0 to 65535.
@return group — The group as an integer from -32768 to 32767.
getFriction
(method) love.Fixture:getFriction()
-> friction: number
Returns the friction of the fixture.
@return friction — The fixture friction.
getGroupIndex
(method) love.Fixture:getGroupIndex()
-> group: number
Returns the group the fixture belongs to. Fixtures with the same group will always collide if the group is positive or never collide if it's negative. The group zero means no group.
The groups range from -32768 to 32767.
@return group — The group of the fixture.
getMask
(method) love.Fixture:getMask()
Returns which categories this fixture should '''NOT''' collide with.
getMassData
(method) love.Fixture:getMassData()
-> x: number
2. y: number
3. mass: number
4. inertia: number
Returns the mass, its center and the rotational inertia.
@return x — The x position of the center of mass.
@return y — The y position of the center of mass.
@return mass — The mass of the fixture.
@return inertia — The rotational inertia.
getRestitution
(method) love.Fixture:getRestitution()
-> restitution: number
Returns the restitution of the fixture.
@return restitution — The fixture restitution.
getShape
(method) love.Fixture:getShape()
-> shape: love.Shape
Returns the shape of the fixture. This shape is a reference to the actual data used in the simulation. It's possible to change its values between timesteps.
@return shape — The fixture's shape.
getUserData
(method) love.Fixture:getUserData()
-> value: any
Returns the Lua value associated with this fixture.
@return value — The Lua value associated with the fixture.
isDestroyed
(method) love.Fixture:isDestroyed()
-> destroyed: boolean
Gets whether the Fixture is destroyed. Destroyed fixtures cannot be used.
@return destroyed — Whether the Fixture is destroyed.
isSensor
(method) love.Fixture:isSensor()
-> sensor: boolean
Returns whether the fixture is a sensor.
@return sensor — If the fixture is a sensor.
rayCast
(method) love.Fixture:rayCast(x1: number, y1: number, x2: number, y2: number, maxFraction: number, childIndex?: number)
-> xn: number
2. yn: number
3. fraction: number
Casts a ray against the shape of the fixture and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned.
The ray starts on the first point of the input line and goes towards the second point of the line. The fifth argument is the maximum distance the ray is going to travel as a scale factor of the input line length.
The childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children.
The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.
hitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction
@param x1 — The x position of the input line starting point.
@param y1 — The y position of the input line starting point.
@param x2 — The x position of the input line end point.
@param y2 — The y position of the input line end point.
@param maxFraction — Ray length parameter.
@param childIndex — The index of the child the ray gets cast against.
@return xn — The x component of the normal vector of the edge where the ray hit the shape.
@return yn — The y component of the normal vector of the edge where the ray hit the shape.
@return fraction — The position on the input line where the intersection happened as a factor of the line length.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setCategory
(method) love.Fixture:setCategory(...number)
Sets the categories the fixture belongs to. There can be up to 16 categories represented as a number from 1 to 16.
All fixture's default category is 1.
setDensity
(method) love.Fixture:setDensity(density: number)
Sets the density of the fixture. Call Body:resetMassData if this needs to take effect immediately.
@param density — The fixture density in kilograms per square meter.
setFilterData
(method) love.Fixture:setFilterData(categories: number, mask: number, group: number)
Sets the filter data of the fixture.
Groups, categories, and mask can be used to define the collision behaviour of the fixture.
If two fixtures are in the same group they either always collide if the group is positive, or never collide if it's negative. If the group is zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks. The fixtures do not collide if that's not the case. If they do have each other's categories selected, the return value of the custom contact filter will be used. They always collide if none was set.
There can be up to 16 categories. Categories and masks are encoded as the bits of a 16-bit integer.
When created, prior to calling this function, all fixtures have category set to 1, mask set to 65535 (all categories) and group set to 0.
This function allows setting all filter data for a fixture at once. To set only the categories, the mask or the group, you can use Fixture:setCategory, Fixture:setMask or Fixture:setGroupIndex respectively.
@param categories — The categories as an integer from 0 to 65535.
@param mask — The mask as an integer from 0 to 65535.
@param group — The group as an integer from -32768 to 32767.
setFriction
(method) love.Fixture:setFriction(friction: number)
Sets the friction of the fixture.
Friction determines how shapes react when they 'slide' along other shapes. Low friction indicates a slippery surface, like ice, while high friction indicates a rough surface, like concrete. Range: 0.0 - 1.0.
@param friction — The fixture friction.
setGroupIndex
(method) love.Fixture:setGroupIndex(group: number)
Sets the group the fixture belongs to. Fixtures with the same group will always collide if the group is positive or never collide if it's negative. The group zero means no group.
The groups range from -32768 to 32767.
@param group — The group as an integer from -32768 to 32767.
setMask
(method) love.Fixture:setMask(...number)
Sets the category mask of the fixture. There can be up to 16 categories represented as a number from 1 to 16.
This fixture will '''NOT''' collide with the fixtures that are in the selected categories if the other fixture also has a category of this fixture selected.
setRestitution
(method) love.Fixture:setRestitution(restitution: number)
Sets the restitution of the fixture.
@param restitution — The fixture restitution.
setSensor
(method) love.Fixture:setSensor(sensor: boolean)
Sets whether the fixture should act as a sensor.
Sensors do not cause collision responses, but the begin-contact and end-contact World callbacks will still be called for this fixture.
@param sensor — The sensor status.
setUserData
(method) love.Fixture:setUserData(value: any)
Associates a Lua value with the fixture.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the fixture.
testPoint
(method) love.Fixture:testPoint(x: number, y: number)
-> isInside: boolean
Checks if a point is inside the shape of the fixture.
@param x — The x position of the point.
@param y — The y position of the point.
@return isInside — True if the point is inside or false if it is outside.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Font
getAscent
(method) love.Font:getAscent()
-> ascent: number
Gets the ascent of the Font.
The ascent spans the distance between the baseline and the top of the glyph that reaches farthest from the baseline.
@return ascent — The ascent of the Font in pixels.
getBaseline
(method) love.Font:getBaseline()
-> baseline: number
Gets the baseline of the Font.
Most scripts share the notion of a baseline: an imaginary horizontal line on which characters rest. In some scripts, parts of glyphs lie below the baseline.
@return baseline — The baseline of the Font in pixels.
getDPIScale
(method) love.Font:getDPIScale()
-> dpiscale: number
Gets the DPI scale factor of the Font.
The DPI scale factor represents relative pixel density. A DPI scale factor of 2 means the font's glyphs have twice the pixel density in each dimension (4 times as many pixels in the same area) compared to a font with a DPI scale factor of 1.
The font size of TrueType fonts is scaled internally by the font's specified DPI scale factor. By default, LÖVE uses the screen's DPI scale factor when creating TrueType fonts.
@return dpiscale — The DPI scale factor of the Font.
getDescent
(method) love.Font:getDescent()
-> descent: number
Gets the descent of the Font.
The descent spans the distance between the baseline and the lowest descending glyph in a typeface.
@return descent — The descent of the Font in pixels.
getFilter
(method) love.Font:getFilter()
-> min: "linear"|"nearest"
2. mag: "linear"|"nearest"
3. anisotropy: number
Gets the filter mode for a font.
@return min — Filter mode used when minifying the font.
@return mag — Filter mode used when magnifying the font.
@return anisotropy — Maximum amount of anisotropic filtering used.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
getHeight
(method) love.Font:getHeight()
-> height: number
Gets the height of the Font.
The height of the font is the size including any spacing; the height which it will need.
@return height — The height of the Font in pixels.
getKerning
(method) love.Font:getKerning(leftchar: string, rightchar: string)
-> kerning: number
Gets the kerning between two characters in the Font.
Kerning is normally handled automatically in love.graphics.print, Text objects, Font:getWidth, Font:getWrap, etc. This function is useful when stitching text together manually.
@param leftchar — The left character.
@param rightchar — The right character.
@return kerning — The kerning amount to add to the spacing between the two characters. May be negative.
getLineHeight
(method) love.Font:getLineHeight()
-> height: number
Gets the line height.
This will be the value previously set by Font:setLineHeight, or 1.0 by default.
@return height — The current line height.
getWidth
(method) love.Font:getWidth(text: string|number)
-> width: number
Determines the maximum width (accounting for newlines) taken by the given string.
@param text — A string or number.
@return width — The width of the text.
getWrap
(method) love.Font:getWrap(text: string, wraplimit: number)
-> width: number
2. wrappedtext: table
Gets formatting information for text, given a wrap limit.
This function accounts for newlines correctly (i.e. '\n').
@param text — The text that will be wrapped.
@param wraplimit — The maximum width in pixels of each line that ''text'' is allowed before wrapping.
@return width — The maximum width of the wrapped text.
@return wrappedtext — A sequence containing each line of text that was wrapped.
hasGlyphs
(method) love.Font:hasGlyphs(text: string)
-> hasglyph: boolean
Gets whether the Font can render a character or string.
@param text — A UTF-8 encoded unicode string.
@return hasglyph — Whether the font can render all the UTF-8 characters in the string.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setFallbacks
(method) love.Font:setFallbacks(fallbackfont1: love.Font, ...love.Font)
Sets the fallback fonts. When the Font doesn't contain a glyph, it will substitute the glyph from the next subsequent fallback Fonts. This is akin to setting a 'font stack' in Cascading Style Sheets (CSS).
@param fallbackfont1 — The first fallback Font to use.
setFilter
(method) love.Font:setFilter(min: "linear"|"nearest", mag: "linear"|"nearest", anisotropy?: number)
Sets the filter mode for a font.
@param min — How to scale a font down.
@param mag — How to scale a font up.
@param anisotropy — Maximum amount of anisotropic filtering used.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
setLineHeight
(method) love.Font:setLineHeight(height: number)
Sets the line height.
When rendering the font in lines the actual height will be determined by the line height multiplied by the height of the font. The default is 1.0.
@param height — The new line height.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.FrictionJoint
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getMaxForce
(method) love.FrictionJoint:getMaxForce()
-> force: number
Gets the maximum friction force in Newtons.
@return force — Maximum force in Newtons.
getMaxTorque
(method) love.FrictionJoint:getMaxTorque()
-> torque: number
Gets the maximum friction torque in Newton-meters.
@return torque — Maximum torque in Newton-meters.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setMaxForce
(method) love.FrictionJoint:setMaxForce(maxForce: number)
Sets the maximum friction force in Newtons.
@param maxForce — Max force in Newtons.
setMaxTorque
(method) love.FrictionJoint:setMaxTorque(torque: number)
Sets the maximum friction torque in Newton-meters.
@param torque — Maximum torque in Newton-meters.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.FullscreenType
love.GamepadAxis
love.GamepadButton
love.GearJoint
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getJoints
(method) love.GearJoint:getJoints()
-> joint1: love.Joint
2. joint2: love.Joint
Get the Joints connected by this GearJoint.
@return joint1 — The first connected Joint.
@return joint2 — The second connected Joint.
getRatio
(method) love.GearJoint:getRatio()
-> ratio: number
Get the ratio of a gear joint.
@return ratio — The ratio of the joint.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setRatio
(method) love.GearJoint:setRatio(ratio: number)
Set the ratio of a gear joint.
@param ratio — The new ratio of the joint.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.GlyphData
clone
(method) love.Data:clone()
-> clone: love.Data
Creates a new copy of the Data object.
@return clone — The new copy.
getAdvance
(method) love.GlyphData:getAdvance()
-> advance: number
Gets glyph advance.
@return advance — Glyph advance.
getBearing
(method) love.GlyphData:getBearing()
-> bx: number
2. by: number
Gets glyph bearing.
@return bx — Glyph bearing X.
@return by — Glyph bearing Y.
getBoundingBox
(method) love.GlyphData:getBoundingBox()
-> x: number
2. y: number
3. width: number
4. height: number
Gets glyph bounding box.
@return x — Glyph position x.
@return y — Glyph position y.
@return width — Glyph width.
@return height — Glyph height.
getDimensions
(method) love.GlyphData:getDimensions()
-> width: number
2. height: number
Gets glyph dimensions.
@return width — Glyph width.
@return height — Glyph height.
getFFIPointer
(method) love.Data:getFFIPointer()
-> pointer: ffi.cdata*
Gets an FFI pointer to the Data.
This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.
@return pointer — A raw void* pointer to the Data, or nil if FFI is unavailable.
getFormat
(method) love.GlyphData:getFormat()
-> format: "ASTC10x10"|"ASTC10x5"|"ASTC10x6"|"ASTC10x8"|"ASTC12x10"...(+59)
Gets glyph pixel format.
@return format — Glyph pixel format.
--
-- Pixel formats for Textures, ImageData, and CompressedImageData.
--
--
-- [Open in Browser](https://love2d.org/wiki/PixelFormat)
--
format:
| "unknown" -- Indicates unknown pixel format, used internally.
| "normal" -- Alias for rgba8, or srgba8 if gamma-correct rendering is enabled.
| "hdr" -- A format suitable for high dynamic range content - an alias for the rgba16f format, normally.
| "r8" -- Single-channel (red component) format (8 bpp).
| "rg8" -- Two channels (red and green components) with 8 bits per channel (16 bpp).
| "rgba8" -- 8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders).
| "srgba8" -- gamma-correct version of rgba8.
| "r16" -- Single-channel (red component) format (16 bpp).
| "rg16" -- Two channels (red and green components) with 16 bits per channel (32 bpp).
| "rgba16" -- 16 bits per channel (64 bpp) RGBA. Color channel values range from 0-65535 (0-1 in shaders).
| "r16f" -- Floating point single-channel format (16 bpp). Color values can range from [-65504, +65504].
| "rg16f" -- Floating point two-channel format with 16 bits per channel (32 bpp). Color values can range from [-65504, +65504].
| "rgba16f" -- Floating point RGBA with 16 bits per channel (64 bpp). Color values can range from [-65504, +65504].
| "r32f" -- Floating point single-channel format (32 bpp).
| "rg32f" -- Floating point two-channel format with 32 bits per channel (64 bpp).
| "rgba32f" -- Floating point RGBA with 32 bits per channel (128 bpp).
| "la8" -- Same as rg8, but accessed as (L, L, L, A)
| "rgba4" -- 4 bits per channel (16 bpp) RGBA.
| "rgb5a1" -- RGB with 5 bits each, and a 1-bit alpha channel (16 bpp).
| "rgb565" -- RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format.
| "rgb10a2" -- RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp).
| "rg11b10f" -- Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp). There is no alpha channel. Color values can range from [0, +65024].
| "stencil8" -- No depth buffer and 8-bit stencil buffer.
| "depth16" -- 16-bit depth buffer and no stencil buffer.
| "depth24" -- 24-bit depth buffer and no stencil buffer.
| "depth32f" -- 32-bit float depth buffer and no stencil buffer.
| "depth24stencil8" -- 24-bit depth buffer and 8-bit stencil buffer.
| "depth32fstencil8" -- 32-bit float depth buffer and 8-bit stencil buffer.
| "DXT1" -- The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems.
| "DXT3" -- The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.
| "DXT5" -- The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems.
| "BC4" -- The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
| "BC4s" -- The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "BC5" -- The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
| "BC5s" -- The signed variant of the BC5 format.
| "BC6h" -- The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems.
| "BC6hs" -- The signed variant of the BC6H format. Stores RGB data in the range of +65504.
| "BC7" -- The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.
| "ETC1" -- The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.
| "ETC2rgb" -- The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.
| "ETC2rgba" -- The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.
| "ETC2rgba1" -- The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.
| "EACr" -- The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.
| "EACrs" -- The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "EACrg" -- The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.
| "EACrgs" -- The signed two-channel variant of the EAC format.
| "PVR1rgb2" -- The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized.
| "PVR1rgb4" -- The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.
| "PVR1rgba2" -- The 2 bit per pixel RGBA variant of the PVRTC1 format.
| "PVR1rgba4" -- The 4 bit per pixel RGBA variant of the PVRTC1 format.
| "ASTC4x4" -- The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.
| "ASTC5x4" -- The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.
| "ASTC5x5" -- The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.
| "ASTC6x5" -- The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.
| "ASTC6x6" -- The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.
| "ASTC8x5" -- The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.
| "ASTC8x6" -- The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.
| "ASTC8x8" -- The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.
| "ASTC10x5" -- The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.
| "ASTC10x6" -- The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.
| "ASTC10x8" -- The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.
| "ASTC10x10" -- The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.
| "ASTC12x10" -- The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.
| "ASTC12x12" -- The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.
getGlyph
(method) love.GlyphData:getGlyph()
-> glyph: number
Gets glyph number.
@return glyph — Glyph number.
getGlyphString
(method) love.GlyphData:getGlyphString()
-> glyph: string
Gets glyph string.
@return glyph — Glyph string.
getHeight
(method) love.GlyphData:getHeight()
-> height: number
Gets glyph height.
@return height — Glyph height.
getPointer
(method) love.Data:getPointer()
-> pointer: lightuserdata
Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
@return pointer — A raw pointer to the Data.
getSize
(method) love.Data:getSize()
-> size: number
Gets the Data's size in bytes.
@return size — The size of the Data in bytes.
getString
(method) love.Data:getString()
-> data: string
Gets the full Data as a string.
@return data — The raw data.
getWidth
(method) love.GlyphData:getWidth()
-> width: number
Gets glyph width.
@return width — Glyph width.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.GraphicsFeature
love.GraphicsLimit
love.HashFunction
love.HintingMode
love.Image
getDPIScale
(method) love.Texture:getDPIScale()
-> dpiscale: number
Gets the DPI scale factor of the Texture.
The DPI scale factor represents relative pixel density. A DPI scale factor of 2 means the texture has twice the pixel density in each dimension (4 times as many pixels in the same area) compared to a texture with a DPI scale factor of 1.
For example, a texture with pixel dimensions of 100x100 with a DPI scale factor of 2 will be drawn as if it was 50x50. This is useful with high-dpi / retina displays to easily allow swapping out higher or lower pixel density Images and Canvases without needing any extra manual scaling logic.
@return dpiscale — The DPI scale factor of the Texture.
getDepth
(method) love.Texture:getDepth()
-> depth: number
Gets the depth of a Volume Texture. Returns 1 for 2D, Cubemap, and Array textures.
@return depth — The depth of the volume Texture.
getDepthSampleMode
(method) love.Texture:getDepthSampleMode()
-> compare: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3)
Gets the comparison mode used when sampling from a depth texture in a shader.
Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D.
@return compare — The comparison mode used when sampling from this texture in a shader, or nil if setDepthSampleMode has not been called on this Texture.
--
-- Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompareMode)
--
compare:
| "equal" -- * stencil tests: the stencil value of the pixel must be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.
| "notequal" -- * stencil tests: the stencil value of the pixel must not be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel.
| "less" -- * stencil tests: the stencil value of the pixel must be less than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.
| "lequal" -- * stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.
| "gequal" -- * stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.
| "greater" -- * stencil tests: the stencil value of the pixel must be greater than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.
| "never" -- Objects will never be drawn.
| "always" -- Objects will always be drawn. Effectively disables the depth or stencil test.
getDimensions
(method) love.Texture:getDimensions()
-> width: number
2. height: number
Gets the width and height of the Texture.
@return width — The width of the Texture.
@return height — The height of the Texture.
getFilter
(method) love.Texture:getFilter()
-> min: "linear"|"nearest"
2. mag: "linear"|"nearest"
3. anisotropy: number
Gets the filter mode of the Texture.
@return min — Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels).
@return mag — Filter mode to use when magnifying the texture (rendering it at a smaller size on-screen than its size in pixels).
@return anisotropy — Maximum amount of anisotropic filtering used.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
getFormat
(method) love.Texture:getFormat()
-> format: "ASTC10x10"|"ASTC10x5"|"ASTC10x6"|"ASTC10x8"|"ASTC12x10"...(+59)
Gets the pixel format of the Texture.
@return format — The pixel format the Texture was created with.
--
-- Pixel formats for Textures, ImageData, and CompressedImageData.
--
--
-- [Open in Browser](https://love2d.org/wiki/PixelFormat)
--
format:
| "unknown" -- Indicates unknown pixel format, used internally.
| "normal" -- Alias for rgba8, or srgba8 if gamma-correct rendering is enabled.
| "hdr" -- A format suitable for high dynamic range content - an alias for the rgba16f format, normally.
| "r8" -- Single-channel (red component) format (8 bpp).
| "rg8" -- Two channels (red and green components) with 8 bits per channel (16 bpp).
| "rgba8" -- 8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders).
| "srgba8" -- gamma-correct version of rgba8.
| "r16" -- Single-channel (red component) format (16 bpp).
| "rg16" -- Two channels (red and green components) with 16 bits per channel (32 bpp).
| "rgba16" -- 16 bits per channel (64 bpp) RGBA. Color channel values range from 0-65535 (0-1 in shaders).
| "r16f" -- Floating point single-channel format (16 bpp). Color values can range from [-65504, +65504].
| "rg16f" -- Floating point two-channel format with 16 bits per channel (32 bpp). Color values can range from [-65504, +65504].
| "rgba16f" -- Floating point RGBA with 16 bits per channel (64 bpp). Color values can range from [-65504, +65504].
| "r32f" -- Floating point single-channel format (32 bpp).
| "rg32f" -- Floating point two-channel format with 32 bits per channel (64 bpp).
| "rgba32f" -- Floating point RGBA with 32 bits per channel (128 bpp).
| "la8" -- Same as rg8, but accessed as (L, L, L, A)
| "rgba4" -- 4 bits per channel (16 bpp) RGBA.
| "rgb5a1" -- RGB with 5 bits each, and a 1-bit alpha channel (16 bpp).
| "rgb565" -- RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format.
| "rgb10a2" -- RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp).
| "rg11b10f" -- Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp). There is no alpha channel. Color values can range from [0, +65024].
| "stencil8" -- No depth buffer and 8-bit stencil buffer.
| "depth16" -- 16-bit depth buffer and no stencil buffer.
| "depth24" -- 24-bit depth buffer and no stencil buffer.
| "depth32f" -- 32-bit float depth buffer and no stencil buffer.
| "depth24stencil8" -- 24-bit depth buffer and 8-bit stencil buffer.
| "depth32fstencil8" -- 32-bit float depth buffer and 8-bit stencil buffer.
| "DXT1" -- The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems.
| "DXT3" -- The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.
| "DXT5" -- The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems.
| "BC4" -- The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
| "BC4s" -- The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "BC5" -- The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
| "BC5s" -- The signed variant of the BC5 format.
| "BC6h" -- The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems.
| "BC6hs" -- The signed variant of the BC6H format. Stores RGB data in the range of +65504.
| "BC7" -- The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.
| "ETC1" -- The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.
| "ETC2rgb" -- The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.
| "ETC2rgba" -- The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.
| "ETC2rgba1" -- The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.
| "EACr" -- The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.
| "EACrs" -- The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "EACrg" -- The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.
| "EACrgs" -- The signed two-channel variant of the EAC format.
| "PVR1rgb2" -- The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized.
| "PVR1rgb4" -- The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.
| "PVR1rgba2" -- The 2 bit per pixel RGBA variant of the PVRTC1 format.
| "PVR1rgba4" -- The 4 bit per pixel RGBA variant of the PVRTC1 format.
| "ASTC4x4" -- The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.
| "ASTC5x4" -- The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.
| "ASTC5x5" -- The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.
| "ASTC6x5" -- The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.
| "ASTC6x6" -- The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.
| "ASTC8x5" -- The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.
| "ASTC8x6" -- The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.
| "ASTC8x8" -- The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.
| "ASTC10x5" -- The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.
| "ASTC10x6" -- The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.
| "ASTC10x8" -- The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.
| "ASTC10x10" -- The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.
| "ASTC12x10" -- The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.
| "ASTC12x12" -- The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.
getHeight
(method) love.Texture:getHeight()
-> height: number
Gets the height of the Texture.
@return height — The height of the Texture.
getLayerCount
(method) love.Texture:getLayerCount()
-> layers: number
Gets the number of layers / slices in an Array Texture. Returns 1 for 2D, Cubemap, and Volume textures.
@return layers — The number of layers in the Array Texture.
getMipmapCount
(method) love.Texture:getMipmapCount()
-> mipmaps: number
Gets the number of mipmaps contained in the Texture. If the texture was not created with mipmaps, it will return 1.
@return mipmaps — The number of mipmaps in the Texture.
getMipmapFilter
(method) love.Texture:getMipmapFilter()
-> mode: "linear"|"nearest"
2. sharpness: number
Gets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images.
@return mode — The filter mode used in between mipmap levels. nil if mipmap filtering is not enabled.
@return sharpness — Value used to determine whether the image should use more or less detailed mipmap levels than normal when drawing.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mode:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
getPixelDimensions
(method) love.Texture:getPixelDimensions()
-> pixelwidth: number
2. pixelheight: number
Gets the width and height in pixels of the Texture.
Texture:getDimensions gets the dimensions of the texture in units scaled by the texture's DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelDimensions only when dealing specifically with pixels, for example when using Canvas:newImageData.
@return pixelwidth — The width of the Texture, in pixels.
@return pixelheight — The height of the Texture, in pixels.
getPixelHeight
(method) love.Texture:getPixelHeight()
-> pixelheight: number
Gets the height in pixels of the Texture.
DPI scale factor, rather than pixels. Use getHeight for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelHeight only when dealing specifically with pixels, for example when using Canvas:newImageData.
@return pixelheight — The height of the Texture, in pixels.
getPixelWidth
(method) love.Texture:getPixelWidth()
-> pixelwidth: number
Gets the width in pixels of the Texture.
DPI scale factor, rather than pixels. Use getWidth for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelWidth only when dealing specifically with pixels, for example when using Canvas:newImageData.
@return pixelwidth — The width of the Texture, in pixels.
getTextureType
(method) love.Texture:getTextureType()
-> texturetype: "2d"|"array"|"cube"|"volume"
Gets the type of the Texture.
@return texturetype — The type of the Texture.
--
-- Types of textures (2D, cubemap, etc.)
--
--
-- [Open in Browser](https://love2d.org/wiki/TextureType)
--
texturetype:
| "2d" -- Regular 2D texture with width and height.
| "array" -- Several same-size 2D textures organized into a single object. Similar to a texture atlas / sprite sheet, but avoids sprite bleeding and other issues.
| "cube" -- Cubemap texture with 6 faces. Requires a custom shader (and Shader:send) to use. Sampling from a cube texture in a shader takes a 3D direction vector instead of a texture coordinate.
| "volume" -- 3D texture with width, height, and depth. Requires a custom shader to use. Volume textures can have texture filtering applied along the 3rd axis.
getWidth
(method) love.Texture:getWidth()
-> width: number
Gets the width of the Texture.
@return width — The width of the Texture.
getWrap
(method) love.Texture:getWrap()
-> horiz: "clamp"|"clampzero"|"mirroredrepeat"|"repeat"
2. vert: "clamp"|"clampzero"|"mirroredrepeat"|"repeat"
3. depth: "clamp"|"clampzero"|"mirroredrepeat"|"repeat"
Gets the wrapping properties of a Texture.
This function returns the currently set horizontal and vertical wrapping modes for the texture.
@return horiz — Horizontal wrapping mode of the texture.
@return vert — Vertical wrapping mode of the texture.
@return depth — Wrapping mode for the z-axis of a Volume texture.
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
horiz:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
vert:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
depth:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
isCompressed
(method) love.Image:isCompressed()
-> compressed: boolean
Gets whether the Image was created from CompressedData.
Compressed images take up less space in VRAM, and drawing a compressed image will generally be more efficient than drawing one created from raw pixel data.
@return compressed — Whether the Image is stored as a compressed texture on the GPU.
isFormatLinear
(method) love.Image:isFormatLinear()
-> linear: boolean
Gets whether the Image was created with the linear (non-gamma corrected) flag set to true.
This method always returns false when gamma-correct rendering is not enabled.
@return linear — Whether the Image's internal pixel format is linear (not gamma corrected), when gamma-correct rendering is enabled.
isReadable
(method) love.Texture:isReadable()
-> readable: boolean
Gets whether the Texture can be drawn and sent to a Shader.
Canvases created with stencil and/or depth PixelFormats are not readable by default, unless readable=true is specified in the settings table passed into love.graphics.newCanvas.
Non-readable Canvases can still be rendered to.
@return readable — Whether the Texture is readable.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
replacePixels
(method) love.Image:replacePixels(data: love.ImageData, slice?: number, mipmap?: number, x?: number, y?: number, reloadmipmaps?: boolean)
Replace the contents of an Image.
@param data — The new ImageData to replace the contents with.
@param slice — Which cubemap face, array index, or volume layer to replace, if applicable.
@param mipmap — The mimap level to replace, if the Image has mipmaps.
@param x — The x-offset in pixels from the top-left of the image to replace. The given ImageData's width plus this value must not be greater than the pixel width of the Image's specified mipmap level.
@param y — The y-offset in pixels from the top-left of the image to replace. The given ImageData's height plus this value must not be greater than the pixel height of the Image's specified mipmap level.
@param reloadmipmaps — Whether to generate new mipmaps after replacing the Image's pixels. True by default if the Image was created with automatically generated mipmaps, false by default otherwise.
setDepthSampleMode
(method) love.Texture:setDepthSampleMode(compare: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3))
Sets the comparison mode used when sampling from a depth texture in a shader. Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D.
When using a depth texture with a comparison mode set in a shader, it must be declared as a sampler2DShadow and used in a GLSL 3 Shader. The result of accessing the texture in the shader will return a float between 0 and 1, proportional to the number of samples (up to 4 samples will be used if bilinear filtering is enabled) that passed the test set by the comparison operation.
Depth texture comparison can only be used with readable depth-formatted Canvases.
@param compare — The comparison mode used when sampling from this texture in a shader.
--
-- Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompareMode)
--
compare:
| "equal" -- * stencil tests: the stencil value of the pixel must be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.
| "notequal" -- * stencil tests: the stencil value of the pixel must not be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel.
| "less" -- * stencil tests: the stencil value of the pixel must be less than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.
| "lequal" -- * stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.
| "gequal" -- * stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.
| "greater" -- * stencil tests: the stencil value of the pixel must be greater than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.
| "never" -- Objects will never be drawn.
| "always" -- Objects will always be drawn. Effectively disables the depth or stencil test.
setFilter
(method) love.Texture:setFilter(min: "linear"|"nearest", mag?: "linear"|"nearest", anisotropy?: number)
Sets the filter mode of the Texture.
@param min — Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels).
@param mag — Filter mode to use when magnifying the texture (rendering it at a larger size on-screen than its size in pixels).
@param anisotropy — Maximum amount of anisotropic filtering to use.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
setMipmapFilter
(method) love.Texture:setMipmapFilter(filtermode: "linear"|"nearest", sharpness?: number)
Sets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images.
Mipmapping is useful when drawing a texture at a reduced scale. It can improve performance and reduce aliasing issues.
In created with the mipmaps flag enabled for the mipmap filter to have any effect. In versions prior to 0.10.0 it's best to call this method directly after creating the image with love.graphics.newImage, to avoid bugs in certain graphics drivers.
Due to hardware restrictions and driver bugs, in versions prior to 0.10.0 images that weren't loaded from a CompressedData must have power-of-two dimensions (64x64, 512x256, etc.) to use mipmaps.
@param filtermode — The filter mode to use in between mipmap levels. 'nearest' will often give better performance.
@param sharpness — A positive sharpness value makes the texture use a more detailed mipmap level when drawing, at the expense of performance. A negative value does the reverse.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
filtermode:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
setWrap
(method) love.Texture:setWrap(horiz: "clamp"|"clampzero"|"mirroredrepeat"|"repeat", vert?: "clamp"|"clampzero"|"mirroredrepeat"|"repeat", depth?: "clamp"|"clampzero"|"mirroredrepeat"|"repeat")
Sets the wrapping properties of a Texture.
This function sets the way a Texture is repeated when it is drawn with a Quad that is larger than the texture's extent, or when a custom Shader is used which uses texture coordinates outside of [0, 1]. A texture may be clamped or set to repeat in both horizontal and vertical directions.
Clamped textures appear only once (with the edges of the texture stretching to fill the extent of the Quad), whereas repeated ones repeat as many times as there is room in the Quad.
@param horiz — Horizontal wrapping mode of the texture.
@param vert — Vertical wrapping mode of the texture.
@param depth — Wrapping mode for the z-axis of a Volume texture.
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
horiz:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
vert:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
depth:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.ImageData
clone
(method) love.Data:clone()
-> clone: love.Data
Creates a new copy of the Data object.
@return clone — The new copy.
encode
(method) love.ImageData:encode(format: "bmp"|"jpg"|"png"|"tga", filename?: string)
-> filedata: love.FileData
Encodes the ImageData and optionally writes it to the save directory.
@param format — The format to encode the image as.
@param filename — The filename to write the file to. If nil, no file will be written but the FileData will still be returned.
@return filedata — The encoded image as a new FileData object.
--
-- Encoded image formats.
--
--
-- [Open in Browser](https://love2d.org/wiki/ImageFormat)
--
format:
| "tga" -- Targa image format.
| "png" -- PNG image format.
| "jpg" -- JPG image format.
| "bmp" -- BMP image format.
getDimensions
(method) love.ImageData:getDimensions()
-> width: number
2. height: number
Gets the width and height of the ImageData in pixels.
@return width — The width of the ImageData in pixels.
@return height — The height of the ImageData in pixels.
getFFIPointer
(method) love.Data:getFFIPointer()
-> pointer: ffi.cdata*
Gets an FFI pointer to the Data.
This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.
@return pointer — A raw void* pointer to the Data, or nil if FFI is unavailable.
getFormat
(method) love.ImageData:getFormat()
-> format: "ASTC10x10"|"ASTC10x5"|"ASTC10x6"|"ASTC10x8"|"ASTC12x10"...(+59)
Gets the pixel format of the ImageData.
@return format — The pixel format the ImageData was created with.
--
-- Pixel formats for Textures, ImageData, and CompressedImageData.
--
--
-- [Open in Browser](https://love2d.org/wiki/PixelFormat)
--
format:
| "unknown" -- Indicates unknown pixel format, used internally.
| "normal" -- Alias for rgba8, or srgba8 if gamma-correct rendering is enabled.
| "hdr" -- A format suitable for high dynamic range content - an alias for the rgba16f format, normally.
| "r8" -- Single-channel (red component) format (8 bpp).
| "rg8" -- Two channels (red and green components) with 8 bits per channel (16 bpp).
| "rgba8" -- 8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders).
| "srgba8" -- gamma-correct version of rgba8.
| "r16" -- Single-channel (red component) format (16 bpp).
| "rg16" -- Two channels (red and green components) with 16 bits per channel (32 bpp).
| "rgba16" -- 16 bits per channel (64 bpp) RGBA. Color channel values range from 0-65535 (0-1 in shaders).
| "r16f" -- Floating point single-channel format (16 bpp). Color values can range from [-65504, +65504].
| "rg16f" -- Floating point two-channel format with 16 bits per channel (32 bpp). Color values can range from [-65504, +65504].
| "rgba16f" -- Floating point RGBA with 16 bits per channel (64 bpp). Color values can range from [-65504, +65504].
| "r32f" -- Floating point single-channel format (32 bpp).
| "rg32f" -- Floating point two-channel format with 32 bits per channel (64 bpp).
| "rgba32f" -- Floating point RGBA with 32 bits per channel (128 bpp).
| "la8" -- Same as rg8, but accessed as (L, L, L, A)
| "rgba4" -- 4 bits per channel (16 bpp) RGBA.
| "rgb5a1" -- RGB with 5 bits each, and a 1-bit alpha channel (16 bpp).
| "rgb565" -- RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format.
| "rgb10a2" -- RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp).
| "rg11b10f" -- Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp). There is no alpha channel. Color values can range from [0, +65024].
| "stencil8" -- No depth buffer and 8-bit stencil buffer.
| "depth16" -- 16-bit depth buffer and no stencil buffer.
| "depth24" -- 24-bit depth buffer and no stencil buffer.
| "depth32f" -- 32-bit float depth buffer and no stencil buffer.
| "depth24stencil8" -- 24-bit depth buffer and 8-bit stencil buffer.
| "depth32fstencil8" -- 32-bit float depth buffer and 8-bit stencil buffer.
| "DXT1" -- The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems.
| "DXT3" -- The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.
| "DXT5" -- The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems.
| "BC4" -- The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
| "BC4s" -- The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "BC5" -- The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
| "BC5s" -- The signed variant of the BC5 format.
| "BC6h" -- The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems.
| "BC6hs" -- The signed variant of the BC6H format. Stores RGB data in the range of +65504.
| "BC7" -- The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.
| "ETC1" -- The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.
| "ETC2rgb" -- The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.
| "ETC2rgba" -- The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.
| "ETC2rgba1" -- The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.
| "EACr" -- The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.
| "EACrs" -- The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "EACrg" -- The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.
| "EACrgs" -- The signed two-channel variant of the EAC format.
| "PVR1rgb2" -- The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized.
| "PVR1rgb4" -- The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.
| "PVR1rgba2" -- The 2 bit per pixel RGBA variant of the PVRTC1 format.
| "PVR1rgba4" -- The 4 bit per pixel RGBA variant of the PVRTC1 format.
| "ASTC4x4" -- The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.
| "ASTC5x4" -- The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.
| "ASTC5x5" -- The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.
| "ASTC6x5" -- The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.
| "ASTC6x6" -- The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.
| "ASTC8x5" -- The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.
| "ASTC8x6" -- The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.
| "ASTC8x8" -- The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.
| "ASTC10x5" -- The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.
| "ASTC10x6" -- The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.
| "ASTC10x8" -- The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.
| "ASTC10x10" -- The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.
| "ASTC12x10" -- The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.
| "ASTC12x12" -- The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.
getHeight
(method) love.ImageData:getHeight()
-> height: number
Gets the height of the ImageData in pixels.
@return height — The height of the ImageData in pixels.
getPixel
(method) love.ImageData:getPixel(x: number, y: number)
-> r: number
2. g: number
3. b: number
4. a: number
Gets the color of a pixel at a specific position in the image.
Valid x and y values start at 0 and go up to image width and height minus 1. Non-integer values are floored.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@param x — The position of the pixel on the x-axis.
@param y — The position of the pixel on the y-axis.
@return r — The red component (0-1).
@return g — The green component (0-1).
@return b — The blue component (0-1).
@return a — The alpha component (0-1).
getPointer
(method) love.Data:getPointer()
-> pointer: lightuserdata
Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
@return pointer — A raw pointer to the Data.
getSize
(method) love.Data:getSize()
-> size: number
Gets the Data's size in bytes.
@return size — The size of the Data in bytes.
getString
(method) love.Data:getString()
-> data: string
Gets the full Data as a string.
@return data — The raw data.
getWidth
(method) love.ImageData:getWidth()
-> width: number
Gets the width of the ImageData in pixels.
@return width — The width of the ImageData in pixels.
mapPixel
(method) love.ImageData:mapPixel(pixelFunction: function, x?: number, y?: number, width?: number, height?: number)
Transform an image by applying a function to every pixel.
This function is a higher-order function. It takes another function as a parameter, and calls it once for each pixel in the ImageData.
The passed function is called with six parameters for each pixel in turn. The parameters are numbers that represent the x and y coordinates of the pixel and its red, green, blue and alpha values. The function should return the new red, green, blue, and alpha values for that pixel.
function pixelFunction(x, y, r, g, b, a)
-- template for defining your own pixel mapping function
-- perform computations giving the new values for r, g, b and a
-- ...
return r, g, b, a
end
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@param pixelFunction — Function to apply to every pixel.
@param x — The x-axis of the top-left corner of the area within the ImageData to apply the function to.
@param y — The y-axis of the top-left corner of the area within the ImageData to apply the function to.
@param width — The width of the area within the ImageData to apply the function to.
@param height — The height of the area within the ImageData to apply the function to.
paste
(method) love.ImageData:paste(source: love.ImageData, dx: number, dy: number, sx: number, sy: number, sw: number, sh: number)
Paste into ImageData from another source ImageData.
@param source — Source ImageData from which to copy.
@param dx — Destination top-left position on x-axis.
@param dy — Destination top-left position on y-axis.
@param sx — Source top-left position on x-axis.
@param sy — Source top-left position on y-axis.
@param sw — Source width.
@param sh — Source height.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setPixel
(method) love.ImageData:setPixel(x: number, y: number, r: number, g: number, b: number, a: number)
Sets the color of a pixel at a specific position in the image.
Valid x and y values start at 0 and go up to image width and height minus 1.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@param x — The position of the pixel on the x-axis.
@param y — The position of the pixel on the y-axis.
@param r — The red component (0-1).
@param g — The green component (0-1).
@param b — The blue component (0-1).
@param a — The alpha component (0-1).
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.ImageFormat
love.IndexDataType
love.Joint
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.JointType
love.Joystick
getAxes
(method) love.Joystick:getAxes()
-> axisDir1: number
2. axisDir2: number
3. axisDirN: number
Gets the direction of each axis.
@return axisDir1 — Direction of axis1.
@return axisDir2 — Direction of axis2.
@return axisDirN — Direction of axisN.
getAxis
(method) love.Joystick:getAxis(axis: number)
-> direction: number
Gets the direction of an axis.
@param axis — The index of the axis to be checked.
@return direction — Current value of the axis.
getAxisCount
(method) love.Joystick:getAxisCount()
-> axes: number
Gets the number of axes on the joystick.
@return axes — The number of axes available.
getButtonCount
(method) love.Joystick:getButtonCount()
-> buttons: number
Gets the number of buttons on the joystick.
@return buttons — The number of buttons available.
getDeviceInfo
(method) love.Joystick:getDeviceInfo()
-> vendorID: number
2. productID: number
3. productVersion: number
Gets the USB vendor ID, product ID, and product version numbers of joystick which consistent across operating systems.
Can be used to show different icons, etc. for different gamepads.
@return vendorID — The USB vendor ID of the joystick.
@return productID — The USB product ID of the joystick.
@return productVersion — The product version of the joystick.
getGUID
(method) love.Joystick:getGUID()
-> guid: string
Gets a stable GUID unique to the type of the physical joystick which does not change over time. For example, all Sony Dualshock 3 controllers in OS X have the same GUID. The value is platform-dependent.
@return guid — The Joystick type's OS-dependent unique identifier.
getGamepadAxis
(method) love.Joystick:getGamepadAxis(axis: "leftx"|"lefty"|"rightx"|"righty"|"triggerleft"...(+1))
-> direction: number
Gets the direction of a virtual gamepad axis. If the Joystick isn't recognized as a gamepad or isn't connected, this function will always return 0.
@param axis — The virtual axis to be checked.
@return direction — Current value of the axis.
--
-- Virtual gamepad axes.
--
--
-- [Open in Browser](https://love2d.org/wiki/GamepadAxis)
--
axis:
| "leftx" -- The x-axis of the left thumbstick.
| "lefty" -- The y-axis of the left thumbstick.
| "rightx" -- The x-axis of the right thumbstick.
| "righty" -- The y-axis of the right thumbstick.
| "triggerleft" -- Left analog trigger.
| "triggerright" -- Right analog trigger.
getGamepadMapping
(method) love.Joystick:getGamepadMapping(axis: "leftx"|"lefty"|"rightx"|"righty"|"triggerleft"...(+1))
-> inputtype: "axis"|"button"|"hat"
2. inputindex: number
3. hatdirection: "c"|"d"|"l"|"ld"|"lu"...(+4)
Gets the button, axis or hat that a virtual gamepad input is bound to.
@param axis — The virtual gamepad axis to get the binding for.
@return inputtype — The type of input the virtual gamepad axis is bound to.
@return inputindex — The index of the Joystick's button, axis or hat that the virtual gamepad axis is bound to.
@return hatdirection — The direction of the hat, if the virtual gamepad axis is bound to a hat. nil otherwise.
--
-- Virtual gamepad axes.
--
--
-- [Open in Browser](https://love2d.org/wiki/GamepadAxis)
--
axis:
| "leftx" -- The x-axis of the left thumbstick.
| "lefty" -- The y-axis of the left thumbstick.
| "rightx" -- The x-axis of the right thumbstick.
| "righty" -- The y-axis of the right thumbstick.
| "triggerleft" -- Left analog trigger.
| "triggerright" -- Right analog trigger.
--
-- Types of Joystick inputs.
--
--
-- [Open in Browser](https://love2d.org/wiki/JoystickInputType)
--
inputtype:
| "axis" -- Analog axis.
| "button" -- Button.
| "hat" -- 8-direction hat value.
--
-- Joystick hat positions.
--
--
-- [Open in Browser](https://love2d.org/wiki/JoystickHat)
--
hatdirection:
| "c" -- Centered
| "d" -- Down
| "l" -- Left
| "ld" -- Left+Down
| "lu" -- Left+Up
| "r" -- Right
| "rd" -- Right+Down
| "ru" -- Right+Up
| "u" -- Up
getGamepadMappingString
(method) love.Joystick:getGamepadMappingString()
-> mappingstring: string
Gets the full gamepad mapping string of this Joystick, or nil if it's not recognized as a gamepad.
The mapping string contains binding information used to map the Joystick's buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings.
@return mappingstring — A string containing the Joystick's gamepad mappings, or nil if the Joystick is not recognized as a gamepad.
getHat
(method) love.Joystick:getHat(hat: number)
-> direction: "c"|"d"|"l"|"ld"|"lu"...(+4)
Gets the direction of the Joystick's hat.
@param hat — The index of the hat to be checked.
@return direction — The direction the hat is pushed.
--
-- Joystick hat positions.
--
--
-- [Open in Browser](https://love2d.org/wiki/JoystickHat)
--
direction:
| "c" -- Centered
| "d" -- Down
| "l" -- Left
| "ld" -- Left+Down
| "lu" -- Left+Up
| "r" -- Right
| "rd" -- Right+Down
| "ru" -- Right+Up
| "u" -- Up
getHatCount
(method) love.Joystick:getHatCount()
-> hats: number
Gets the number of hats on the joystick.
@return hats — How many hats the joystick has.
getID
(method) love.Joystick:getID()
-> id: number
2. instanceid: number
Gets the joystick's unique identifier. The identifier will remain the same for the life of the game, even when the Joystick is disconnected and reconnected, but it '''will''' change when the game is re-launched.
@return id — The Joystick's unique identifier. Remains the same as long as the game is running.
@return instanceid — Unique instance identifier. Changes every time the Joystick is reconnected. nil if the Joystick is not connected.
getName
(method) love.Joystick:getName()
-> name: string
Gets the name of the joystick.
@return name — The name of the joystick.
getVibration
(method) love.Joystick:getVibration()
-> left: number
2. right: number
Gets the current vibration motor strengths on a Joystick with rumble support.
@return left — Current strength of the left vibration motor on the Joystick.
@return right — Current strength of the right vibration motor on the Joystick.
isConnected
(method) love.Joystick:isConnected()
-> connected: boolean
Gets whether the Joystick is connected.
@return connected — True if the Joystick is currently connected, false otherwise.
isDown
(method) love.Joystick:isDown(buttonN: number)
-> anyDown: boolean
Checks if a button on the Joystick is pressed.
LÖVE 0.9.0 had a bug which required the button indices passed to Joystick:isDown to be 0-based instead of 1-based, for example button 1 would be 0 for this function. It was fixed in 0.9.1.
@param buttonN — The index of a button to check.
@return anyDown — True if any supplied button is down, false if not.
isGamepad
(method) love.Joystick:isGamepad()
-> isgamepad: boolean
Gets whether the Joystick is recognized as a gamepad. If this is the case, the Joystick's buttons and axes can be used in a standardized manner across different operating systems and joystick models via Joystick:getGamepadAxis, Joystick:isGamepadDown, love.gamepadpressed, and related functions.
LÖVE automatically recognizes most popular controllers with a similar layout to the Xbox 360 controller as gamepads, but you can add more with love.joystick.setGamepadMapping.
@return isgamepad — True if the Joystick is recognized as a gamepad, false otherwise.
isGamepadDown
(method) love.Joystick:isGamepadDown(buttonN: "a"|"b"|"back"|"dpdown"|"dpleft"...(+10))
-> anyDown: boolean
Checks if a virtual gamepad button on the Joystick is pressed. If the Joystick is not recognized as a Gamepad or isn't connected, then this function will always return false.
@param buttonN — The gamepad button to check.
@return anyDown — True if any supplied button is down, false if not.
--
-- Virtual gamepad buttons.
--
--
-- [Open in Browser](https://love2d.org/wiki/GamepadButton)
--
buttonN:
| "a" -- Bottom face button (A).
| "b" -- Right face button (B).
| "x" -- Left face button (X).
| "y" -- Top face button (Y).
| "back" -- Back button.
| "guide" -- Guide button.
| "start" -- Start button.
| "leftstick" -- Left stick click button.
| "rightstick" -- Right stick click button.
| "leftshoulder" -- Left bumper.
| "rightshoulder" -- Right bumper.
| "dpup" -- D-pad up.
| "dpdown" -- D-pad down.
| "dpleft" -- D-pad left.
| "dpright" -- D-pad right.
isVibrationSupported
(method) love.Joystick:isVibrationSupported()
-> supported: boolean
Gets whether the Joystick supports vibration.
@return supported — True if rumble / force feedback vibration is supported on this Joystick, false if not.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setVibration
(method) love.Joystick:setVibration(left: number, right: number)
-> success: boolean
Sets the vibration motor speeds on a Joystick with rumble support. Most common gamepads have this functionality, although not all drivers give proper support. Use Joystick:isVibrationSupported to check.
@param left — Strength of the left vibration motor on the Joystick. Must be in the range of 1.
@param right — Strength of the right vibration motor on the Joystick. Must be in the range of 1.
@return success — True if the vibration was successfully applied, false if not.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.JoystickHat
love.JoystickInputType
love.KeyConstant
love.LineJoin
love.LineStyle
love.MatrixLayout
love.Mesh
attachAttribute
(method) love.Mesh:attachAttribute(name: string, mesh: love.Mesh)
Attaches a vertex attribute from a different Mesh onto this Mesh, for use when drawing. This can be used to share vertex attribute data between several different Meshes.
@param name — The name of the vertex attribute to attach.
@param mesh — The Mesh to get the vertex attribute from.
detachAttribute
(method) love.Mesh:detachAttribute(name: string)
-> success: boolean
Removes a previously attached vertex attribute from this Mesh.
@param name — The name of the attached vertex attribute to detach.
@return success — Whether the attribute was successfully detached.
flush
(method) love.Mesh:flush()
Immediately sends all modified vertex data in the Mesh to the graphics card.
Normally it isn't necessary to call this method as love.graphics.draw(mesh, ...) will do it automatically if needed, but explicitly using Mesh:flush gives more control over when the work happens.
If this method is used, it generally shouldn't be called more than once (at most) between love.graphics.draw(mesh, ...) calls.
getDrawMode
(method) love.Mesh:getDrawMode()
-> mode: "fan"|"points"|"strip"|"triangles"
Gets the mode used when drawing the Mesh.
@return mode — The mode used when drawing the Mesh.
--
-- How a Mesh's vertices are used when drawing.
--
--
-- [Open in Browser](https://love2d.org/wiki/MeshDrawMode)
--
mode:
| "fan" -- The vertices create a "fan" shape with the first vertex acting as the hub point. Can be easily used to draw simple convex polygons.
| "strip" -- The vertices create a series of connected triangles using vertices 1, 2, 3, then 3, 2, 4 (note the order), then 3, 4, 5, and so on.
| "triangles" -- The vertices create unconnected triangles.
| "points" -- The vertices are drawn as unconnected points (see love.graphics.setPointSize.)
getDrawRange
(method) love.Mesh:getDrawRange()
-> min: number
2. max: number
Gets the range of vertices used when drawing the Mesh.
@return min — The index of the first vertex used when drawing, or the index of the first value in the vertex map used if one is set for this Mesh.
@return max — The index of the last vertex used when drawing, or the index of the last value in the vertex map used if one is set for this Mesh.
getTexture
(method) love.Mesh:getTexture()
-> texture: love.Texture
Gets the texture (Image or Canvas) used when drawing the Mesh.
@return texture — The Image or Canvas to texture the Mesh with when drawing, or nil if none is set.
getVertex
(method) love.Mesh:getVertex(index: number)
-> attributecomponent: number
Gets the properties of a vertex in the Mesh.
In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.
@param index — The one-based index of the vertex you want to retrieve the information for.
@return attributecomponent — The first component of the first vertex attribute in the specified vertex.
getVertexAttribute
(method) love.Mesh:getVertexAttribute(vertexindex: number, attributeindex: number)
-> value1: number
2. value2: number
Gets the properties of a specific attribute within a vertex in the Mesh.
Meshes without a custom vertex format specified in love.graphics.newMesh have position as their first attribute, texture coordinates as their second attribute, and color as their third attribute.
@param vertexindex — The index of the the vertex you want to retrieve the attribute for (one-based).
@param attributeindex — The index of the attribute within the vertex to be retrieved (one-based).
@return value1 — The value of the first component of the attribute.
@return value2 — The value of the second component of the attribute.
getVertexCount
(method) love.Mesh:getVertexCount()
-> count: number
Gets the total number of vertices in the Mesh.
@return count — The total number of vertices in the mesh.
getVertexFormat
(method) love.Mesh:getVertexFormat()
-> format: { attribute: table }
Gets the vertex format that the Mesh was created with.
@return format — The vertex format of the Mesh, which is a table containing tables for each vertex attribute the Mesh was created with, in the form of {attribute, ...}.
getVertexMap
(method) love.Mesh:getVertexMap()
-> map: table
Gets the vertex map for the Mesh. The vertex map describes the order in which the vertices are used when the Mesh is drawn. The vertices, vertex map, and mesh draw mode work together to determine what exactly is displayed on the screen.
If no vertex map has been set previously via Mesh:setVertexMap, then this function will return nil in LÖVE 0.10.0+, or an empty table in 0.9.2 and older.
@return map — A table containing the list of vertex indices used when drawing.
isAttributeEnabled
(method) love.Mesh:isAttributeEnabled(name: string)
-> enabled: boolean
Gets whether a specific vertex attribute in the Mesh is enabled. Vertex data from disabled attributes is not used when drawing the Mesh.
@param name — The name of the vertex attribute to be checked.
@return enabled — Whether the vertex attribute is used when drawing this Mesh.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setAttributeEnabled
(method) love.Mesh:setAttributeEnabled(name: string, enable: boolean)
Enables or disables a specific vertex attribute in the Mesh. Vertex data from disabled attributes is not used when drawing the Mesh.
@param name — The name of the vertex attribute to enable or disable.
@param enable — Whether the vertex attribute is used when drawing this Mesh.
setDrawMode
(method) love.Mesh:setDrawMode(mode: "fan"|"points"|"strip"|"triangles")
Sets the mode used when drawing the Mesh.
@param mode — The mode to use when drawing the Mesh.
--
-- How a Mesh's vertices are used when drawing.
--
--
-- [Open in Browser](https://love2d.org/wiki/MeshDrawMode)
--
mode:
| "fan" -- The vertices create a "fan" shape with the first vertex acting as the hub point. Can be easily used to draw simple convex polygons.
| "strip" -- The vertices create a series of connected triangles using vertices 1, 2, 3, then 3, 2, 4 (note the order), then 3, 4, 5, and so on.
| "triangles" -- The vertices create unconnected triangles.
| "points" -- The vertices are drawn as unconnected points (see love.graphics.setPointSize.)
setDrawRange
(method) love.Mesh:setDrawRange(start: number, count: number)
Restricts the drawn vertices of the Mesh to a subset of the total.
@param start — The index of the first vertex to use when drawing, or the index of the first value in the vertex map to use if one is set for this Mesh.
@param count — The number of vertices to use when drawing, or number of values in the vertex map to use if one is set for this Mesh.
setTexture
(method) love.Mesh:setTexture(texture: love.Texture)
Sets the texture (Image or Canvas) used when drawing the Mesh.
@param texture — The Image or Canvas to texture the Mesh with when drawing.
setVertex
(method) love.Mesh:setVertex(index: number, attributecomponent: number, ...number)
Sets the properties of a vertex in the Mesh.
In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.
@param index — The index of the the vertex you want to modify (one-based).
@param attributecomponent — The first component of the first vertex attribute in the specified vertex.
setVertexAttribute
(method) love.Mesh:setVertexAttribute(vertexindex: number, attributeindex: number, value1: number, value2: number, ...number)
Sets the properties of a specific attribute within a vertex in the Mesh.
Meshes without a custom vertex format specified in love.graphics.newMesh have position as their first attribute, texture coordinates as their second attribute, and color as their third attribute.
@param vertexindex — The index of the the vertex to be modified (one-based).
@param attributeindex — The index of the attribute within the vertex to be modified (one-based).
@param value1 — The new value for the first component of the attribute.
@param value2 — The new value for the second component of the attribute.
setVertexMap
(method) love.Mesh:setVertexMap(map: table)
Sets the vertex map for the Mesh. The vertex map describes the order in which the vertices are used when the Mesh is drawn. The vertices, vertex map, and mesh draw mode work together to determine what exactly is displayed on the screen.
The vertex map allows you to re-order or reuse vertices when drawing without changing the actual vertex parameters or duplicating vertices. It is especially useful when combined with different Mesh Draw Modes.
@param map — A table containing a list of vertex indices to use when drawing. Values must be in the range of Mesh:getVertexCount().
setVertices
(method) love.Mesh:setVertices(vertices: { attributecomponent: number }, startvertex?: number, count?: number)
Replaces a range of vertices in the Mesh with new ones. The total number of vertices in a Mesh cannot be changed after it has been created. This is often more efficient than calling Mesh:setVertex in a loop.
@param vertices — The table filled with vertex information tables for each vertex, in the form of {vertex, ...} where each vertex is a table in the form of {attributecomponent, ...}.
@param startvertex — The index of the first vertex to replace.
@param count — Amount of vertices to replace.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.MeshDrawMode
love.MessageBoxType
love.MipmapMode
love.MotorJoint
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getAngularOffset
(method) love.MotorJoint:getAngularOffset()
-> angleoffset: number
Gets the target angular offset between the two Bodies the Joint is attached to.
@return angleoffset — The target angular offset in radians: the second body's angle minus the first body's angle.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getLinearOffset
(method) love.MotorJoint:getLinearOffset()
-> x: number
2. y: number
Gets the target linear offset between the two Bodies the Joint is attached to.
@return x — The x component of the target linear offset, relative to the first Body.
@return y — The y component of the target linear offset, relative to the first Body.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setAngularOffset
(method) love.MotorJoint:setAngularOffset(angleoffset: number)
Sets the target angluar offset between the two Bodies the Joint is attached to.
@param angleoffset — The target angular offset in radians: the second body's angle minus the first body's angle.
setLinearOffset
(method) love.MotorJoint:setLinearOffset(x: number, y: number)
Sets the target linear offset between the two Bodies the Joint is attached to.
@param x — The x component of the target linear offset, relative to the first Body.
@param y — The y component of the target linear offset, relative to the first Body.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.MouseJoint
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getDampingRatio
(method) love.MouseJoint:getDampingRatio()
-> ratio: number
Returns the damping ratio.
@return ratio — The new damping ratio.
getFrequency
(method) love.MouseJoint:getFrequency()
-> freq: number
Returns the frequency.
@return freq — The frequency in hertz.
getMaxForce
(method) love.MouseJoint:getMaxForce()
-> f: number
Gets the highest allowed force.
@return f — The max allowed force.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getTarget
(method) love.MouseJoint:getTarget()
-> x: number
2. y: number
Gets the target point.
@return x — The x-component of the target.
@return y — The x-component of the target.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setDampingRatio
(method) love.MouseJoint:setDampingRatio(ratio: number)
Sets a new damping ratio.
@param ratio — The new damping ratio.
setFrequency
(method) love.MouseJoint:setFrequency(freq: number)
Sets a new frequency.
@param freq — The new frequency in hertz.
setMaxForce
(method) love.MouseJoint:setMaxForce(f: number)
Sets the highest allowed force.
@param f — The max allowed force.
setTarget
(method) love.MouseJoint:setTarget(x: number, y: number)
Sets the target point.
@param x — The x-component of the target.
@param y — The y-component of the target.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Object
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.ParticleInsertMode
love.ParticleSystem
clone
(method) love.ParticleSystem:clone()
-> particlesystem: love.ParticleSystem
Creates an identical copy of the ParticleSystem in the stopped state.
@return particlesystem — The new identical copy of this ParticleSystem.
emit
(method) love.ParticleSystem:emit(numparticles: number)
Emits a burst of particles from the particle emitter.
@param numparticles — The amount of particles to emit. The number of emitted particles will be truncated if the particle system's max buffer size is reached.
getBufferSize
(method) love.ParticleSystem:getBufferSize()
-> size: number
Gets the maximum number of particles the ParticleSystem can have at once.
@return size — The maximum number of particles.
getColors
(method) love.ParticleSystem:getColors()
-> r1: number
2. g1: number
3. b1: number
4. a1: number
5. r2: number
6. g2: number
7. b2: number
8. a2: number
9. r8: number
10. g8: number
11. b8: number
12. a8: number
Gets the series of colors applied to the particle sprite.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@return r1 — First color, red component (0-1).
@return g1 — First color, green component (0-1).
@return b1 — First color, blue component (0-1).
@return a1 — First color, alpha component (0-1).
@return r2 — Second color, red component (0-1).
@return g2 — Second color, green component (0-1).
@return b2 — Second color, blue component (0-1).
@return a2 — Second color, alpha component (0-1).
@return r8 — Eighth color, red component (0-1).
@return g8 — Eighth color, green component (0-1).
@return b8 — Eighth color, blue component (0-1).
@return a8 — Eighth color, alpha component (0-1).
getCount
(method) love.ParticleSystem:getCount()
-> count: number
Gets the number of particles that are currently in the system.
@return count — The current number of live particles.
getDirection
(method) love.ParticleSystem:getDirection()
-> direction: number
Gets the direction of the particle emitter (in radians).
@return direction — The direction of the emitter (radians).
getEmissionArea
(method) love.ParticleSystem:getEmissionArea()
-> distribution: "borderellipse"|"borderrectangle"|"ellipse"|"none"|"normal"...(+1)
2. dx: number
3. dy: number
4. angle: number
5. directionRelativeToCenter: boolean
Gets the area-based spawn parameters for the particles.
@return distribution — The type of distribution for new particles.
@return dx — The maximum spawn distance from the emitter along the x-axis for uniform distribution, or the standard deviation along the x-axis for normal distribution.
@return dy — The maximum spawn distance from the emitter along the y-axis for uniform distribution, or the standard deviation along the y-axis for normal distribution.
@return angle — The angle in radians of the emission area.
@return directionRelativeToCenter — True if newly spawned particles will be oriented relative to the center of the emission area, false otherwise.
--
-- Types of particle area spread distribution.
--
--
-- [Open in Browser](https://love2d.org/wiki/AreaSpreadDistribution)
--
distribution:
| "uniform" -- Uniform distribution.
| "normal" -- Normal (gaussian) distribution.
| "ellipse" -- Uniform distribution in an ellipse.
| "borderellipse" -- Distribution in an ellipse with particles spawning at the edges of the ellipse.
| "borderrectangle" -- Distribution in a rectangle with particles spawning at the edges of the rectangle.
| "none" -- No distribution - area spread is disabled.
getEmissionRate
(method) love.ParticleSystem:getEmissionRate()
-> rate: number
Gets the amount of particles emitted per second.
@return rate — The amount of particles per second.
getEmitterLifetime
(method) love.ParticleSystem:getEmitterLifetime()
-> life: number
Gets how long the particle system will emit particles (if -1 then it emits particles forever).
@return life — The lifetime of the emitter (in seconds).
getInsertMode
(method) love.ParticleSystem:getInsertMode()
-> mode: "bottom"|"random"|"top"
Gets the mode used when the ParticleSystem adds new particles.
@return mode — The mode used when the ParticleSystem adds new particles.
--
-- How newly created particles are added to the ParticleSystem.
--
--
-- [Open in Browser](https://love2d.org/wiki/ParticleInsertMode)
--
mode:
| "top" -- Particles are inserted at the top of the ParticleSystem's list of particles.
| "bottom" -- Particles are inserted at the bottom of the ParticleSystem's list of particles.
| "random" -- Particles are inserted at random positions in the ParticleSystem's list of particles.
getLinearAcceleration
(method) love.ParticleSystem:getLinearAcceleration()
-> xmin: number
2. ymin: number
3. xmax: number
4. ymax: number
Gets the linear acceleration (acceleration along the x and y axes) for particles.
Every particle created will accelerate along the x and y axes between xmin,ymin and xmax,ymax.
@return xmin — The minimum acceleration along the x axis.
@return ymin — The minimum acceleration along the y axis.
@return xmax — The maximum acceleration along the x axis.
@return ymax — The maximum acceleration along the y axis.
getLinearDamping
(method) love.ParticleSystem:getLinearDamping()
-> min: number
2. max: number
Gets the amount of linear damping (constant deceleration) for particles.
@return min — The minimum amount of linear damping applied to particles.
@return max — The maximum amount of linear damping applied to particles.
getOffset
(method) love.ParticleSystem:getOffset()
-> ox: number
2. oy: number
Gets the particle image's draw offset.
@return ox — The x coordinate of the particle image's draw offset.
@return oy — The y coordinate of the particle image's draw offset.
getParticleLifetime
(method) love.ParticleSystem:getParticleLifetime()
-> min: number
2. max: number
Gets the lifetime of the particles.
@return min — The minimum life of the particles (in seconds).
@return max — The maximum life of the particles (in seconds).
getPosition
(method) love.ParticleSystem:getPosition()
-> x: number
2. y: number
Gets the position of the emitter.
@return x — Position along x-axis.
@return y — Position along y-axis.
getQuads
(method) love.ParticleSystem:getQuads()
-> quads: table
Gets the series of Quads used for the particle sprites.
@return quads — A table containing the Quads used.
getRadialAcceleration
(method) love.ParticleSystem:getRadialAcceleration()
-> min: number
2. max: number
Gets the radial acceleration (away from the emitter).
@return min — The minimum acceleration.
@return max — The maximum acceleration.
getRotation
(method) love.ParticleSystem:getRotation()
-> min: number
2. max: number
Gets the rotation of the image upon particle creation (in radians).
@return min — The minimum initial angle (radians).
@return max — The maximum initial angle (radians).
getSizeVariation
(method) love.ParticleSystem:getSizeVariation()
-> variation: number
Gets the amount of size variation (0 meaning no variation and 1 meaning full variation between start and end).
@return variation — The amount of variation (0 meaning no variation and 1 meaning full variation between start and end).
getSizes
(method) love.ParticleSystem:getSizes()
-> size1: number
2. size2: number
3. size8: number
Gets the series of sizes by which the sprite is scaled. 1.0 is normal size. The particle system will interpolate between each size evenly over the particle's lifetime.
@return size1 — The first size.
@return size2 — The second size.
@return size8 — The eighth size.
getSpeed
(method) love.ParticleSystem:getSpeed()
-> min: number
2. max: number
Gets the speed of the particles.
@return min — The minimum linear speed of the particles.
@return max — The maximum linear speed of the particles.
getSpin
(method) love.ParticleSystem:getSpin()
-> min: number
2. max: number
3. variation: number
Gets the spin of the sprite.
@return min — The minimum spin (radians per second).
@return max — The maximum spin (radians per second).
@return variation — The degree of variation (0 meaning no variation and 1 meaning full variation between start and end).
getSpinVariation
(method) love.ParticleSystem:getSpinVariation()
-> variation: number
Gets the amount of spin variation (0 meaning no variation and 1 meaning full variation between start and end).
@return variation — The amount of variation (0 meaning no variation and 1 meaning full variation between start and end).
getSpread
(method) love.ParticleSystem:getSpread()
-> spread: number
Gets the amount of directional spread of the particle emitter (in radians).
@return spread — The spread of the emitter (radians).
getTangentialAcceleration
(method) love.ParticleSystem:getTangentialAcceleration()
-> min: number
2. max: number
Gets the tangential acceleration (acceleration perpendicular to the particle's direction).
@return min — The minimum acceleration.
@return max — The maximum acceleration.
getTexture
(method) love.ParticleSystem:getTexture()
-> texture: love.Texture
Gets the texture (Image or Canvas) used for the particles.
@return texture — The Image or Canvas used for the particles.
hasRelativeRotation
(method) love.ParticleSystem:hasRelativeRotation()
-> enable: boolean
Gets whether particle angles and rotations are relative to their velocities. If enabled, particles are aligned to the angle of their velocities and rotate relative to that angle.
@return enable — True if relative particle rotation is enabled, false if it's disabled.
isActive
(method) love.ParticleSystem:isActive()
-> active: boolean
Checks whether the particle system is actively emitting particles.
@return active — True if system is active, false otherwise.
isPaused
(method) love.ParticleSystem:isPaused()
-> paused: boolean
Checks whether the particle system is paused.
@return paused — True if system is paused, false otherwise.
isStopped
(method) love.ParticleSystem:isStopped()
-> stopped: boolean
Checks whether the particle system is stopped.
@return stopped — True if system is stopped, false otherwise.
moveTo
(method) love.ParticleSystem:moveTo(x: number, y: number)
Moves the position of the emitter. This results in smoother particle spawning behaviour than if ParticleSystem:setPosition is used every frame.
@param x — Position along x-axis.
@param y — Position along y-axis.
pause
(method) love.ParticleSystem:pause()
Pauses the particle emitter.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
reset
(method) love.ParticleSystem:reset()
Resets the particle emitter, removing any existing particles and resetting the lifetime counter.
setBufferSize
(method) love.ParticleSystem:setBufferSize(size: number)
Sets the size of the buffer (the max allowed amount of particles in the system).
@param size — The buffer size.
setColors
(method) love.ParticleSystem:setColors(r1: number, g1: number, b1: number, a1?: number, r2?: number, g2?: number, b2?: number, a2?: number, r8?: number, g8?: number, b8?: number, a8?: number)
Sets a series of colors to apply to the particle sprite. The particle system will interpolate between each color evenly over the particle's lifetime.
Arguments can be passed in groups of four, representing the components of the desired RGBA value, or as tables of RGBA component values, with a default alpha value of 1 if only three values are given. At least one color must be specified. A maximum of eight may be used.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@param r1 — First color, red component (0-1).
@param g1 — First color, green component (0-1).
@param b1 — First color, blue component (0-1).
@param a1 — First color, alpha component (0-1).
@param r2 — Second color, red component (0-1).
@param g2 — Second color, green component (0-1).
@param b2 — Second color, blue component (0-1).
@param a2 — Second color, alpha component (0-1).
@param r8 — Eighth color, red component (0-1).
@param g8 — Eighth color, green component (0-1).
@param b8 — Eighth color, blue component (0-1).
@param a8 — Eighth color, alpha component (0-1).
setDirection
(method) love.ParticleSystem:setDirection(direction: number)
Sets the direction the particles will be emitted in.
@param direction — The direction of the particles (in radians).
setEmissionArea
(method) love.ParticleSystem:setEmissionArea(distribution: "borderellipse"|"borderrectangle"|"ellipse"|"none"|"normal"...(+1), dx: number, dy: number, angle?: number, directionRelativeToCenter?: boolean)
Sets area-based spawn parameters for the particles. Newly created particles will spawn in an area around the emitter based on the parameters to this function.
@param distribution — The type of distribution for new particles.
@param dx — The maximum spawn distance from the emitter along the x-axis for uniform distribution, or the standard deviation along the x-axis for normal distribution.
@param dy — The maximum spawn distance from the emitter along the y-axis for uniform distribution, or the standard deviation along the y-axis for normal distribution.
@param angle — The angle in radians of the emission area.
@param directionRelativeToCenter — True if newly spawned particles will be oriented relative to the center of the emission area, false otherwise.
--
-- Types of particle area spread distribution.
--
--
-- [Open in Browser](https://love2d.org/wiki/AreaSpreadDistribution)
--
distribution:
| "uniform" -- Uniform distribution.
| "normal" -- Normal (gaussian) distribution.
| "ellipse" -- Uniform distribution in an ellipse.
| "borderellipse" -- Distribution in an ellipse with particles spawning at the edges of the ellipse.
| "borderrectangle" -- Distribution in a rectangle with particles spawning at the edges of the rectangle.
| "none" -- No distribution - area spread is disabled.
setEmissionRate
(method) love.ParticleSystem:setEmissionRate(rate: number)
Sets the amount of particles emitted per second.
@param rate — The amount of particles per second.
setEmitterLifetime
(method) love.ParticleSystem:setEmitterLifetime(life: number)
Sets how long the particle system should emit particles (if -1 then it emits particles forever).
@param life — The lifetime of the emitter (in seconds).
setInsertMode
(method) love.ParticleSystem:setInsertMode(mode: "bottom"|"random"|"top")
Sets the mode to use when the ParticleSystem adds new particles.
@param mode — The mode to use when the ParticleSystem adds new particles.
--
-- How newly created particles are added to the ParticleSystem.
--
--
-- [Open in Browser](https://love2d.org/wiki/ParticleInsertMode)
--
mode:
| "top" -- Particles are inserted at the top of the ParticleSystem's list of particles.
| "bottom" -- Particles are inserted at the bottom of the ParticleSystem's list of particles.
| "random" -- Particles are inserted at random positions in the ParticleSystem's list of particles.
setLinearAcceleration
(method) love.ParticleSystem:setLinearAcceleration(xmin: number, ymin: number, xmax?: number, ymax?: number)
Sets the linear acceleration (acceleration along the x and y axes) for particles.
Every particle created will accelerate along the x and y axes between xmin,ymin and xmax,ymax.
@param xmin — The minimum acceleration along the x axis.
@param ymin — The minimum acceleration along the y axis.
@param xmax — The maximum acceleration along the x axis.
@param ymax — The maximum acceleration along the y axis.
setLinearDamping
(method) love.ParticleSystem:setLinearDamping(min: number, max?: number)
Sets the amount of linear damping (constant deceleration) for particles.
@param min — The minimum amount of linear damping applied to particles.
@param max — The maximum amount of linear damping applied to particles.
setOffset
(method) love.ParticleSystem:setOffset(x: number, y: number)
Set the offset position which the particle sprite is rotated around.
If this function is not used, the particles rotate around their center.
@param x — The x coordinate of the rotation offset.
@param y — The y coordinate of the rotation offset.
setParticleLifetime
(method) love.ParticleSystem:setParticleLifetime(min: number, max?: number)
Sets the lifetime of the particles.
@param min — The minimum life of the particles (in seconds).
@param max — The maximum life of the particles (in seconds).
setPosition
(method) love.ParticleSystem:setPosition(x: number, y: number)
Sets the position of the emitter.
@param x — Position along x-axis.
@param y — Position along y-axis.
setQuads
(method) love.ParticleSystem:setQuads(quad1: love.Quad, quad2: love.Quad)
Sets a series of Quads to use for the particle sprites. Particles will choose a Quad from the list based on the particle's current lifetime, allowing for the use of animated sprite sheets with ParticleSystems.
@param quad1 — The first Quad to use.
@param quad2 — The second Quad to use.
setRadialAcceleration
(method) love.ParticleSystem:setRadialAcceleration(min: number, max?: number)
Set the radial acceleration (away from the emitter).
@param min — The minimum acceleration.
@param max — The maximum acceleration.
setRelativeRotation
(method) love.ParticleSystem:setRelativeRotation(enable: boolean)
Sets whether particle angles and rotations are relative to their velocities. If enabled, particles are aligned to the angle of their velocities and rotate relative to that angle.
@param enable — True to enable relative particle rotation, false to disable it.
setRotation
(method) love.ParticleSystem:setRotation(min: number, max?: number)
Sets the rotation of the image upon particle creation (in radians).
@param min — The minimum initial angle (radians).
@param max — The maximum initial angle (radians).
setSizeVariation
(method) love.ParticleSystem:setSizeVariation(variation: number)
Sets the amount of size variation (0 meaning no variation and 1 meaning full variation between start and end).
@param variation — The amount of variation (0 meaning no variation and 1 meaning full variation between start and end).
setSizes
(method) love.ParticleSystem:setSizes(size1: number, size2?: number, size8?: number)
Sets a series of sizes by which to scale a particle sprite. 1.0 is normal size. The particle system will interpolate between each size evenly over the particle's lifetime.
At least one size must be specified. A maximum of eight may be used.
@param size1 — The first size.
@param size2 — The second size.
@param size8 — The eighth size.
setSpeed
(method) love.ParticleSystem:setSpeed(min: number, max?: number)
Sets the speed of the particles.
@param min — The minimum linear speed of the particles.
@param max — The maximum linear speed of the particles.
setSpin
(method) love.ParticleSystem:setSpin(min: number, max?: number)
Sets the spin of the sprite.
@param min — The minimum spin (radians per second).
@param max — The maximum spin (radians per second).
setSpinVariation
(method) love.ParticleSystem:setSpinVariation(variation: number)
Sets the amount of spin variation (0 meaning no variation and 1 meaning full variation between start and end).
@param variation — The amount of variation (0 meaning no variation and 1 meaning full variation between start and end).
setSpread
(method) love.ParticleSystem:setSpread(spread: number)
Sets the amount of spread for the system.
@param spread — The amount of spread (radians).
setTangentialAcceleration
(method) love.ParticleSystem:setTangentialAcceleration(min: number, max?: number)
Sets the tangential acceleration (acceleration perpendicular to the particle's direction).
@param min — The minimum acceleration.
@param max — The maximum acceleration.
setTexture
(method) love.ParticleSystem:setTexture(texture: love.Texture)
Sets the texture (Image or Canvas) to be used for the particles.
@param texture — An Image or Canvas to use for the particles.
start
(method) love.ParticleSystem:start()
Starts the particle emitter.
stop
(method) love.ParticleSystem:stop()
Stops the particle emitter, resetting the lifetime counter.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
update
(method) love.ParticleSystem:update(dt: number)
Updates the particle system; moving, creating and killing particles.
@param dt — The time (seconds) since last frame.
love.PixelFormat
love.PolygonShape
computeAABB
(method) love.Shape:computeAABB(tx: number, ty: number, tr: number, childIndex?: number)
-> topLeftX: number
2. topLeftY: number
3. bottomRightX: number
4. bottomRightY: number
Returns the points of the bounding box for the transformed shape.
@param tx — The translation of the shape on the x-axis.
@param ty — The translation of the shape on the y-axis.
@param tr — The shape rotation.
@param childIndex — The index of the child to compute the bounding box of.
@return topLeftX — The x position of the top-left point.
@return topLeftY — The y position of the top-left point.
@return bottomRightX — The x position of the bottom-right point.
@return bottomRightY — The y position of the bottom-right point.
computeMass
(method) love.Shape:computeMass(density: number)
-> x: number
2. y: number
3. mass: number
4. inertia: number
Computes the mass properties for the shape with the specified density.
@param density — The shape density.
@return x — The x postition of the center of mass.
@return y — The y postition of the center of mass.
@return mass — The mass of the shape.
@return inertia — The rotational inertia.
getChildCount
(method) love.Shape:getChildCount()
-> count: number
Returns the number of children the shape has.
@return count — The number of children.
getPoints
(method) love.PolygonShape:getPoints()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the local coordinates of the polygon's vertices.
This function has a variable number of return values. It can be used in a nested fashion with love.graphics.polygon.
@return x1 — The x-component of the first vertex.
@return y1 — The y-component of the first vertex.
@return x2 — The x-component of the second vertex.
@return y2 — The y-component of the second vertex.
getRadius
(method) love.Shape:getRadius()
-> radius: number
Gets the radius of the shape.
@return radius — The radius of the shape.
getType
(method) love.Shape:getType()
-> type: "chain"|"circle"|"edge"|"polygon"
Gets a string representing the Shape.
This function can be useful for conditional debug drawing.
@return type — The type of the Shape.
--
-- The different types of Shapes, as returned by Shape:getType.
--
--
-- [Open in Browser](https://love2d.org/wiki/ShapeType)
--
type:
| "circle" -- The Shape is a CircleShape.
| "polygon" -- The Shape is a PolygonShape.
| "edge" -- The Shape is a EdgeShape.
| "chain" -- The Shape is a ChainShape.
rayCast
(method) love.Shape:rayCast(x1: number, y1: number, x2: number, y2: number, maxFraction: number, tx: number, ty: number, tr: number, childIndex?: number)
-> xn: number
2. yn: number
3. fraction: number
Casts a ray against the shape and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned. The Shape can be transformed to get it into the desired position.
The ray starts on the first point of the input line and goes towards the second point of the line. The fourth argument is the maximum distance the ray is going to travel as a scale factor of the input line length.
The childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children.
The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.
hitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction
@param x1 — The x position of the input line starting point.
@param y1 — The y position of the input line starting point.
@param x2 — The x position of the input line end point.
@param y2 — The y position of the input line end point.
@param maxFraction — Ray length parameter.
@param tx — The translation of the shape on the x-axis.
@param ty — The translation of the shape on the y-axis.
@param tr — The shape rotation.
@param childIndex — The index of the child the ray gets cast against.
@return xn — The x component of the normal vector of the edge where the ray hit the shape.
@return yn — The y component of the normal vector of the edge where the ray hit the shape.
@return fraction — The position on the input line where the intersection happened as a factor of the line length.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
testPoint
(method) love.Shape:testPoint(tx: number, ty: number, tr: number, x: number, y: number)
-> hit: boolean
This is particularly useful for mouse interaction with the shapes. By looping through all shapes and testing the mouse position with this function, we can find which shapes the mouse touches.
@param tx — Translates the shape along the x-axis.
@param ty — Translates the shape along the y-axis.
@param tr — Rotates the shape.
@param x — The x-component of the point.
@param y — The y-component of the point.
@return hit — True if inside, false if outside
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.PowerState
love.PrismaticJoint
areLimitsEnabled
(method) love.PrismaticJoint:areLimitsEnabled()
-> enabled: boolean
Checks whether the limits are enabled.
@return enabled — True if enabled, false otherwise.
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getAxis
(method) love.PrismaticJoint:getAxis()
-> x: number
2. y: number
Gets the world-space axis vector of the Prismatic Joint.
@return x — The x-axis coordinate of the world-space axis vector.
@return y — The y-axis coordinate of the world-space axis vector.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getJointSpeed
(method) love.PrismaticJoint:getJointSpeed()
-> s: number
Get the current joint angle speed.
@return s — Joint angle speed in meters/second.
getJointTranslation
(method) love.PrismaticJoint:getJointTranslation()
-> t: number
Get the current joint translation.
@return t — Joint translation, usually in meters..
getLimits
(method) love.PrismaticJoint:getLimits()
-> lower: number
2. upper: number
Gets the joint limits.
@return lower — The lower limit, usually in meters.
@return upper — The upper limit, usually in meters.
getLowerLimit
(method) love.PrismaticJoint:getLowerLimit()
-> lower: number
Gets the lower limit.
@return lower — The lower limit, usually in meters.
getMaxMotorForce
(method) love.PrismaticJoint:getMaxMotorForce()
-> f: number
Gets the maximum motor force.
@return f — The maximum motor force, usually in N.
getMotorForce
(method) love.PrismaticJoint:getMotorForce(invdt: number)
-> force: number
Returns the current motor force.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return force — The force on the motor in newtons.
getMotorSpeed
(method) love.PrismaticJoint:getMotorSpeed()
-> s: number
Gets the motor speed.
@return s — The motor speed, usually in meters per second.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getReferenceAngle
(method) love.PrismaticJoint:getReferenceAngle()
-> angle: number
Gets the reference angle.
@return angle — The reference angle in radians.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUpperLimit
(method) love.PrismaticJoint:getUpperLimit()
-> upper: number
Gets the upper limit.
@return upper — The upper limit, usually in meters.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
isMotorEnabled
(method) love.PrismaticJoint:isMotorEnabled()
-> enabled: boolean
Checks whether the motor is enabled.
@return enabled — True if enabled, false if disabled.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setLimits
(method) love.PrismaticJoint:setLimits(lower: number, upper: number)
Sets the limits.
@param lower — The lower limit, usually in meters.
@param upper — The upper limit, usually in meters.
setLimitsEnabled
(method) love.PrismaticJoint:setLimitsEnabled()
-> enable: boolean
Enables/disables the joint limit.
@return enable — True if enabled, false if disabled.
setLowerLimit
(method) love.PrismaticJoint:setLowerLimit(lower: number)
Sets the lower limit.
@param lower — The lower limit, usually in meters.
setMaxMotorForce
(method) love.PrismaticJoint:setMaxMotorForce(f: number)
Set the maximum motor force.
@param f — The maximum motor force, usually in N.
setMotorEnabled
(method) love.PrismaticJoint:setMotorEnabled(enable: boolean)
Enables/disables the joint motor.
@param enable — True to enable, false to disable.
setMotorSpeed
(method) love.PrismaticJoint:setMotorSpeed(s: number)
Sets the motor speed.
@param s — The motor speed, usually in meters per second.
setUpperLimit
(method) love.PrismaticJoint:setUpperLimit(upper: number)
Sets the upper limit.
@param upper — The upper limit, usually in meters.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.PulleyJoint
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getConstant
(method) love.PulleyJoint:getConstant()
-> length: number
Get the total length of the rope.
@return length — The length of the rope in the joint.
getGroundAnchors
(method) love.PulleyJoint:getGroundAnchors()
-> a1x: number
2. a1y: number
3. a2x: number
4. a2y: number
Get the ground anchor positions in world coordinates.
@return a1x — The x coordinate of the first anchor.
@return a1y — The y coordinate of the first anchor.
@return a2x — The x coordinate of the second anchor.
@return a2y — The y coordinate of the second anchor.
getLengthA
(method) love.PulleyJoint:getLengthA()
-> length: number
Get the current length of the rope segment attached to the first body.
@return length — The length of the rope segment.
getLengthB
(method) love.PulleyJoint:getLengthB()
-> length: number
Get the current length of the rope segment attached to the second body.
@return length — The length of the rope segment.
getMaxLengths
(method) love.PulleyJoint:getMaxLengths()
-> len1: number
2. len2: number
Get the maximum lengths of the rope segments.
@return len1 — The maximum length of the first rope segment.
@return len2 — The maximum length of the second rope segment.
getRatio
(method) love.PulleyJoint:getRatio()
-> ratio: number
Get the pulley ratio.
@return ratio — The pulley ratio of the joint.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setConstant
(method) love.PulleyJoint:setConstant(length: number)
Set the total length of the rope.
Setting a new length for the rope updates the maximum length values of the joint.
@param length — The new length of the rope in the joint.
setMaxLengths
(method) love.PulleyJoint:setMaxLengths(max1: number, max2: number)
Set the maximum lengths of the rope segments.
The physics module also imposes maximum values for the rope segments. If the parameters exceed these values, the maximum values are set instead of the requested values.
@param max1 — The new maximum length of the first segment.
@param max2 — The new maximum length of the second segment.
setRatio
(method) love.PulleyJoint:setRatio(ratio: number)
Set the pulley ratio.
@param ratio — The new pulley ratio of the joint.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Quad
getTextureDimensions
(method) love.Quad:getTextureDimensions()
-> sw: number
2. sh: number
Gets reference texture dimensions initially specified in love.graphics.newQuad.
@return sw — The Texture width used by the Quad.
@return sh — The Texture height used by the Quad.
getViewport
(method) love.Quad:getViewport()
-> x: number
2. y: number
3. w: number
4. h: number
Gets the current viewport of this Quad.
@return x — The top-left corner along the x-axis.
@return y — The top-left corner along the y-axis.
@return w — The width of the viewport.
@return h — The height of the viewport.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setViewport
(method) love.Quad:setViewport(x: number, y: number, w: number, h: number, sw: number, sh: number)
Sets the texture coordinates according to a viewport.
@param x — The top-left corner along the x-axis.
@param y — The top-left corner along the y-axis.
@param w — The width of the viewport.
@param h — The height of the viewport.
@param sw — The reference width, the width of the Image. (Must be greater than 0.)
@param sh — The reference height, the height of the Image. (Must be greater than 0.)
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.RandomGenerator
getSeed
(method) love.RandomGenerator:getSeed()
-> low: number
2. high: number
Gets the seed of the random number generator object.
The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed value is an integer number in the range of 2^64 - 1.
@return low — Integer number representing the lower 32 bits of the RandomGenerator's 64 bit seed value.
@return high — Integer number representing the higher 32 bits of the RandomGenerator's 64 bit seed value.
getState
(method) love.RandomGenerator:getState()
-> state: string
Gets the current state of the random number generator. This returns an opaque string which is only useful for later use with RandomGenerator:setState in the same major version of LÖVE.
This is different from RandomGenerator:getSeed in that getState gets the RandomGenerator's current state, whereas getSeed gets the previously set seed number.
@return state — The current state of the RandomGenerator object, represented as a string.
random
(method) love.RandomGenerator:random()
-> number: number
Generates a pseudo-random number in a platform independent manner.
@return number — The pseudo-random number.
randomNormal
(method) love.RandomGenerator:randomNormal(stddev?: number, mean?: number)
-> number: number
Get a normally distributed pseudo random number.
@param stddev — Standard deviation of the distribution.
@param mean — The mean of the distribution.
@return number — Normally distributed random number with variance (stddev)² and the specified mean.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setSeed
(method) love.RandomGenerator:setSeed(seed: number)
Sets the seed of the random number generator using the specified integer number.
@param seed — The integer number with which you want to seed the randomization. Must be within the range of 2^53.
setState
(method) love.RandomGenerator:setState(state: string)
Sets the current state of the random number generator. The value used as an argument for this function is an opaque string and should only originate from a previous call to RandomGenerator:getState in the same major version of LÖVE.
This is different from RandomGenerator:setSeed in that setState directly sets the RandomGenerator's current implementation-dependent state, whereas setSeed gives it a new seed value.
@param state — The new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Rasterizer
getAdvance
(method) love.Rasterizer:getAdvance()
-> advance: number
Gets font advance.
@return advance — Font advance.
getAscent
(method) love.Rasterizer:getAscent()
-> height: number
Gets ascent height.
@return height — Ascent height.
getDescent
(method) love.Rasterizer:getDescent()
-> height: number
Gets descent height.
@return height — Descent height.
getGlyphCount
(method) love.Rasterizer:getGlyphCount()
-> count: number
Gets number of glyphs in font.
@return count — Glyphs count.
getGlyphData
(method) love.Rasterizer:getGlyphData(glyph: string)
-> glyphData: love.GlyphData
Gets glyph data of a specified glyph.
@param glyph — Glyph
@return glyphData — Glyph data
getHeight
(method) love.Rasterizer:getHeight()
-> height: number
Gets font height.
@return height — Font height
getLineHeight
(method) love.Rasterizer:getLineHeight()
-> height: number
Gets line height of a font.
@return height — Line height of a font.
hasGlyphs
(method) love.Rasterizer:hasGlyphs(glyph1: string|number, glyph2: string|number, ...string|number)
-> hasGlyphs: boolean
Checks if font contains specified glyphs.
@param glyph1 — Glyph
@param glyph2 — Glyph
@return hasGlyphs — Whatever font contains specified glyphs.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.RecordingDevice
getBitDepth
(method) love.RecordingDevice:getBitDepth()
-> bits: number
Gets the number of bits per sample in the data currently being recorded.
@return bits — The number of bits per sample in the data that's currently being recorded.
getChannelCount
(method) love.RecordingDevice:getChannelCount()
-> channels: number
Gets the number of channels currently being recorded (mono or stereo).
@return channels — The number of channels being recorded (1 for mono, 2 for stereo).
getData
(method) love.RecordingDevice:getData()
-> data: love.SoundData
Gets all recorded audio SoundData stored in the device's internal ring buffer.
The internal ring buffer is cleared when this function is called, so calling it again will only get audio recorded after the previous call. If the device's internal ring buffer completely fills up before getData is called, the oldest data that doesn't fit into the buffer will be lost.
@return data — The recorded audio data, or nil if the device isn't recording.
getName
(method) love.RecordingDevice:getName()
-> name: string
Gets the name of the recording device.
@return name — The name of the device.
getSampleCount
(method) love.RecordingDevice:getSampleCount()
-> samples: number
Gets the number of currently recorded samples.
@return samples — The number of samples that have been recorded so far.
getSampleRate
(method) love.RecordingDevice:getSampleRate()
-> rate: number
Gets the number of samples per second currently being recorded.
@return rate — The number of samples being recorded per second (sample rate).
isRecording
(method) love.RecordingDevice:isRecording()
-> recording: boolean
Gets whether the device is currently recording.
@return recording — True if the recording, false otherwise.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
start
(method) love.RecordingDevice:start(samplecount: number, samplerate?: number, bitdepth?: number, channels?: number)
-> success: boolean
Begins recording audio using this device.
@param samplecount — The maximum number of samples to store in an internal ring buffer when recording. RecordingDevice:getData clears the internal buffer when called.
@param samplerate — The number of samples per second to store when recording.
@param bitdepth — The number of bits per sample.
@param channels — Whether to record in mono or stereo. Most microphones don't support more than 1 channel.
@return success — True if the device successfully began recording using the specified parameters, false if not.
stop
(method) love.RecordingDevice:stop()
-> data: love.SoundData
Stops recording audio from this device. Any sound data currently in the device's buffer will be returned.
@return data — The sound data currently in the device's buffer, or nil if the device wasn't recording.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.RevoluteJoint
areLimitsEnabled
(method) love.RevoluteJoint:areLimitsEnabled()
-> enabled: boolean
Checks whether limits are enabled.
@return enabled — True if enabled, false otherwise.
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getJointAngle
(method) love.RevoluteJoint:getJointAngle()
-> angle: number
Get the current joint angle.
@return angle — The joint angle in radians.
getJointSpeed
(method) love.RevoluteJoint:getJointSpeed()
-> s: number
Get the current joint angle speed.
@return s — Joint angle speed in radians/second.
getLimits
(method) love.RevoluteJoint:getLimits()
-> lower: number
2. upper: number
Gets the joint limits.
@return lower — The lower limit, in radians.
@return upper — The upper limit, in radians.
getLowerLimit
(method) love.RevoluteJoint:getLowerLimit()
-> lower: number
Gets the lower limit.
@return lower — The lower limit, in radians.
getMaxMotorTorque
(method) love.RevoluteJoint:getMaxMotorTorque()
-> f: number
Gets the maximum motor force.
@return f — The maximum motor force, in Nm.
getMotorSpeed
(method) love.RevoluteJoint:getMotorSpeed()
-> s: number
Gets the motor speed.
@return s — The motor speed, radians per second.
getMotorTorque
(method) love.RevoluteJoint:getMotorTorque()
-> f: number
Get the current motor force.
@return f — The current motor force, in Nm.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getReferenceAngle
(method) love.RevoluteJoint:getReferenceAngle()
-> angle: number
Gets the reference angle.
@return angle — The reference angle in radians.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUpperLimit
(method) love.RevoluteJoint:getUpperLimit()
-> upper: number
Gets the upper limit.
@return upper — The upper limit, in radians.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
hasLimitsEnabled
(method) love.RevoluteJoint:hasLimitsEnabled()
-> enabled: boolean
Checks whether limits are enabled.
@return enabled — True if enabled, false otherwise.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
isMotorEnabled
(method) love.RevoluteJoint:isMotorEnabled()
-> enabled: boolean
Checks whether the motor is enabled.
@return enabled — True if enabled, false if disabled.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setLimits
(method) love.RevoluteJoint:setLimits(lower: number, upper: number)
Sets the limits.
@param lower — The lower limit, in radians.
@param upper — The upper limit, in radians.
setLimitsEnabled
(method) love.RevoluteJoint:setLimitsEnabled(enable: boolean)
Enables/disables the joint limit.
@param enable — True to enable, false to disable.
setLowerLimit
(method) love.RevoluteJoint:setLowerLimit(lower: number)
Sets the lower limit.
@param lower — The lower limit, in radians.
setMaxMotorTorque
(method) love.RevoluteJoint:setMaxMotorTorque(f: number)
Set the maximum motor force.
@param f — The maximum motor force, in Nm.
setMotorEnabled
(method) love.RevoluteJoint:setMotorEnabled(enable: boolean)
Enables/disables the joint motor.
@param enable — True to enable, false to disable.
setMotorSpeed
(method) love.RevoluteJoint:setMotorSpeed(s: number)
Sets the motor speed.
@param s — The motor speed, radians per second.
setUpperLimit
(method) love.RevoluteJoint:setUpperLimit(upper: number)
Sets the upper limit.
@param upper — The upper limit, in radians.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.RopeJoint
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getMaxLength
(method) love.RopeJoint:getMaxLength()
-> maxLength: number
Gets the maximum length of a RopeJoint.
@return maxLength — The maximum length of the RopeJoint.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setMaxLength
(method) love.RopeJoint:setMaxLength(maxLength: number)
Sets the maximum length of a RopeJoint.
@param maxLength — The new maximum length of the RopeJoint.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Scancode
love.Shader
getWarnings
(method) love.Shader:getWarnings()
-> warnings: string
Returns any warning and error messages from compiling the shader code. This can be used for debugging your shaders if there's anything the graphics hardware doesn't like.
@return warnings — Warning and error messages (if any).
hasUniform
(method) love.Shader:hasUniform(name: string)
-> hasuniform: boolean
Gets whether a uniform / extern variable exists in the Shader.
If a graphics driver's shader compiler determines that a uniform / extern variable doesn't affect the final output of the shader, it may optimize the variable out. This function will return false in that case.
@param name — The name of the uniform variable.
@return hasuniform — Whether the uniform exists in the shader and affects its final output.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
send
(method) love.Shader:send(name: string, number: number, ...number)
Sends one or more values to a special (''uniform'') variable inside the shader. Uniform variables have to be marked using the ''uniform'' or ''extern'' keyword, e.g.
uniform float time; // 'float' is the typical number type used in GLSL shaders.
uniform float varsvec2 light_pos;
uniform vec4 colors[4;
The corresponding send calls would be
shader:send('time', t)
shader:send('vars',a,b)
shader:send('light_pos', {light_x, light_y})
shader:send('colors', {r1, g1, b1, a1}, {r2, g2, b2, a2}, {r3, g3, b3, a3}, {r4, g4, b4, a4})
Uniform / extern variables are read-only in the shader code and remain constant until modified by a Shader:send call. Uniform variables can be accessed in both the Vertex and Pixel components of a shader, as long as the variable is declared in each.
@param name — Name of the number to send to the shader.
@param number — Number to send to store in the uniform variable.
sendColor
(method) love.Shader:sendColor(name: string, color: table, ...table)
Sends one or more colors to a special (''extern'' / ''uniform'') vec3 or vec4 variable inside the shader. The color components must be in the range of 1. The colors are gamma-corrected if global gamma-correction is enabled.
Extern variables must be marked using the ''extern'' keyword, e.g.
extern vec4 Color;
The corresponding sendColor call would be
shader:sendColor('Color', {r, g, b, a})
Extern variables can be accessed in both the Vertex and Pixel stages of a shader, as long as the variable is declared in each.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@param name — The name of the color extern variable to send to in the shader.
@param color — A table with red, green, blue, and optional alpha color components in the range of 1 to send to the extern as a vector.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Shape
computeAABB
(method) love.Shape:computeAABB(tx: number, ty: number, tr: number, childIndex?: number)
-> topLeftX: number
2. topLeftY: number
3. bottomRightX: number
4. bottomRightY: number
Returns the points of the bounding box for the transformed shape.
@param tx — The translation of the shape on the x-axis.
@param ty — The translation of the shape on the y-axis.
@param tr — The shape rotation.
@param childIndex — The index of the child to compute the bounding box of.
@return topLeftX — The x position of the top-left point.
@return topLeftY — The y position of the top-left point.
@return bottomRightX — The x position of the bottom-right point.
@return bottomRightY — The y position of the bottom-right point.
computeMass
(method) love.Shape:computeMass(density: number)
-> x: number
2. y: number
3. mass: number
4. inertia: number
Computes the mass properties for the shape with the specified density.
@param density — The shape density.
@return x — The x postition of the center of mass.
@return y — The y postition of the center of mass.
@return mass — The mass of the shape.
@return inertia — The rotational inertia.
getChildCount
(method) love.Shape:getChildCount()
-> count: number
Returns the number of children the shape has.
@return count — The number of children.
getRadius
(method) love.Shape:getRadius()
-> radius: number
Gets the radius of the shape.
@return radius — The radius of the shape.
getType
(method) love.Shape:getType()
-> type: "chain"|"circle"|"edge"|"polygon"
Gets a string representing the Shape.
This function can be useful for conditional debug drawing.
@return type — The type of the Shape.
--
-- The different types of Shapes, as returned by Shape:getType.
--
--
-- [Open in Browser](https://love2d.org/wiki/ShapeType)
--
type:
| "circle" -- The Shape is a CircleShape.
| "polygon" -- The Shape is a PolygonShape.
| "edge" -- The Shape is a EdgeShape.
| "chain" -- The Shape is a ChainShape.
rayCast
(method) love.Shape:rayCast(x1: number, y1: number, x2: number, y2: number, maxFraction: number, tx: number, ty: number, tr: number, childIndex?: number)
-> xn: number
2. yn: number
3. fraction: number
Casts a ray against the shape and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned. The Shape can be transformed to get it into the desired position.
The ray starts on the first point of the input line and goes towards the second point of the line. The fourth argument is the maximum distance the ray is going to travel as a scale factor of the input line length.
The childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children.
The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.
hitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction
@param x1 — The x position of the input line starting point.
@param y1 — The y position of the input line starting point.
@param x2 — The x position of the input line end point.
@param y2 — The y position of the input line end point.
@param maxFraction — Ray length parameter.
@param tx — The translation of the shape on the x-axis.
@param ty — The translation of the shape on the y-axis.
@param tr — The shape rotation.
@param childIndex — The index of the child the ray gets cast against.
@return xn — The x component of the normal vector of the edge where the ray hit the shape.
@return yn — The y component of the normal vector of the edge where the ray hit the shape.
@return fraction — The position on the input line where the intersection happened as a factor of the line length.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
testPoint
(method) love.Shape:testPoint(tx: number, ty: number, tr: number, x: number, y: number)
-> hit: boolean
This is particularly useful for mouse interaction with the shapes. By looping through all shapes and testing the mouse position with this function, we can find which shapes the mouse touches.
@param tx — Translates the shape along the x-axis.
@param ty — Translates the shape along the y-axis.
@param tr — Rotates the shape.
@param x — The x-component of the point.
@param y — The y-component of the point.
@return hit — True if inside, false if outside
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.ShapeType
love.SoundData
clone
(method) love.Data:clone()
-> clone: love.Data
Creates a new copy of the Data object.
@return clone — The new copy.
getBitDepth
(method) love.SoundData:getBitDepth()
-> bitdepth: number
Returns the number of bits per sample.
@return bitdepth — Either 8, or 16.
getChannelCount
(method) love.SoundData:getChannelCount()
-> channels: number
Returns the number of channels in the SoundData.
@return channels — 1 for mono, 2 for stereo.
getDuration
(method) love.SoundData:getDuration()
-> duration: number
Gets the duration of the sound data.
@return duration — The duration of the sound data in seconds.
getFFIPointer
(method) love.Data:getFFIPointer()
-> pointer: ffi.cdata*
Gets an FFI pointer to the Data.
This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.
@return pointer — A raw void* pointer to the Data, or nil if FFI is unavailable.
getPointer
(method) love.Data:getPointer()
-> pointer: lightuserdata
Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
@return pointer — A raw pointer to the Data.
getSample
(method) love.SoundData:getSample(i: number)
-> sample: number
Gets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.
@param i — An integer value specifying the position of the sample (starting at 0).
@return sample — The normalized samplepoint (range -1.0 to 1.0).
getSampleCount
(method) love.SoundData:getSampleCount()
-> count: number
Returns the number of samples per channel of the SoundData.
@return count — Total number of samples.
getSampleRate
(method) love.SoundData:getSampleRate()
-> rate: number
Returns the sample rate of the SoundData.
@return rate — Number of samples per second.
getSize
(method) love.Data:getSize()
-> size: number
Gets the Data's size in bytes.
@return size — The size of the Data in bytes.
getString
(method) love.Data:getString()
-> data: string
Gets the full Data as a string.
@return data — The raw data.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setSample
(method) love.SoundData:setSample(i: number, sample: number)
Sets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.
@param i — An integer value specifying the position of the sample (starting at 0).
@param sample — The normalized samplepoint (range -1.0 to 1.0).
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Source
clone
(method) love.Source:clone()
-> source: love.Source
Creates an identical copy of the Source in the stopped state.
Static Sources will use significantly less memory and take much less time to be created if Source:clone is used to create them instead of love.audio.newSource, so this method should be preferred when making multiple Sources which play the same sound.
@return source — The new identical copy of this Source.
getActiveEffects
(method) love.Source:getActiveEffects()
-> effects: table
Gets a list of the Source's active effect names.
@return effects — A list of the source's active effect names.
getAirAbsorption
(method) love.Source:getAirAbsorption()
-> amount: number
Gets the amount of air absorption applied to the Source.
By default the value is set to 0 which means that air absorption effects are disabled. A value of 1 will apply high frequency attenuation to the Source at a rate of 0.05 dB per meter.
@return amount — The amount of air absorption applied to the Source.
getAttenuationDistances
(method) love.Source:getAttenuationDistances()
-> ref: number
2. max: number
Gets the reference and maximum attenuation distances of the Source. The values, combined with the current DistanceModel, affect how the Source's volume attenuates based on distance from the listener.
@return ref — The current reference attenuation distance. If the current DistanceModel is clamped, this is the minimum distance before the Source is no longer attenuated.
@return max — The current maximum attenuation distance.
getChannelCount
(method) love.Source:getChannelCount()
-> channels: number
Gets the number of channels in the Source. Only 1-channel (mono) Sources can use directional and positional effects.
@return channels — 1 for mono, 2 for stereo.
getCone
(method) love.Source:getCone()
-> innerAngle: number
2. outerAngle: number
3. outerVolume: number
Gets the Source's directional volume cones. Together with Source:setDirection, the cone angles allow for the Source's volume to vary depending on its direction.
@return innerAngle — The inner angle from the Source's direction, in radians. The Source will play at normal volume if the listener is inside the cone defined by this angle.
@return outerAngle — The outer angle from the Source's direction, in radians. The Source will play at a volume between the normal and outer volumes, if the listener is in between the cones defined by the inner and outer angles.
@return outerVolume — The Source's volume when the listener is outside both the inner and outer cone angles.
getDirection
(method) love.Source:getDirection()
-> x: number
2. y: number
3. z: number
Gets the direction of the Source.
@return x — The X part of the direction vector.
@return y — The Y part of the direction vector.
@return z — The Z part of the direction vector.
getDuration
(method) love.Source:getDuration(unit?: "samples"|"seconds")
-> duration: number
Gets the duration of the Source. For streaming Sources it may not always be sample-accurate, and may return -1 if the duration cannot be determined at all.
@param unit — The time unit for the return value.
@return duration — The duration of the Source, or -1 if it cannot be determined.
--
-- Units that represent time.
--
--
-- [Open in Browser](https://love2d.org/wiki/TimeUnit)
--
unit:
| "seconds" -- Regular seconds.
| "samples" -- Audio samples.
getEffect
(method) love.Source:getEffect(name: string, filtersettings: table)
-> filtersettings: { volume: number, highgain: number, lowgain: number }
Gets the filter settings associated to a specific effect.
This function returns nil if the effect was applied with no filter settings associated to it.
@param name — The name of the effect.
@param filtersettings — An optional empty table that will be filled with the filter settings.
@return filtersettings — The settings for the filter associated to this effect, or nil if the effect is not present in this Source or has no filter associated. The table has the following fields:
getFilter
(method) love.Source:getFilter()
-> settings: { type: "bandpass"|"highpass"|"lowpass", volume: number, highgain: number, lowgain: number }
Gets the filter settings currently applied to the Source.
@return settings — The filter settings to use for this Source, or nil if the Source has no active filter. The table has the following fields:
getFreeBufferCount
(method) love.Source:getFreeBufferCount()
-> buffers: number
Gets the number of free buffer slots in a queueable Source. If the queueable Source is playing, this value will increase up to the amount the Source was created with. If the queueable Source is stopped, it will process all of its internal buffers first, in which case this function will always return the amount it was created with.
@return buffers — How many more SoundData objects can be queued up.
getPitch
(method) love.Source:getPitch()
-> pitch: number
Gets the current pitch of the Source.
@return pitch — The pitch, where 1.0 is normal.
getPosition
(method) love.Source:getPosition()
-> x: number
2. y: number
3. z: number
Gets the position of the Source.
@return x — The X position of the Source.
@return y — The Y position of the Source.
@return z — The Z position of the Source.
getRolloff
(method) love.Source:getRolloff()
-> rolloff: number
Returns the rolloff factor of the source.
@return rolloff — The rolloff factor.
getType
(method) love.Source:getType()
-> sourcetype: "queue"|"static"|"stream"
Gets the type of the Source.
@return sourcetype — The type of the source.
--
-- Types of audio sources.
--
-- A good rule of thumb is to use stream for music files and static for all short sound effects. Basically, you want to avoid loading large files into memory at once.
--
--
-- [Open in Browser](https://love2d.org/wiki/SourceType)
--
sourcetype:
| "static" -- The whole audio is decoded.
| "stream" -- The audio is decoded in chunks when needed.
| "queue" -- The audio must be manually queued by the user.
getVelocity
(method) love.Source:getVelocity()
-> x: number
2. y: number
3. z: number
Gets the velocity of the Source.
@return x — The X part of the velocity vector.
@return y — The Y part of the velocity vector.
@return z — The Z part of the velocity vector.
getVolume
(method) love.Source:getVolume()
-> volume: number
Gets the current volume of the Source.
@return volume — The volume of the Source, where 1.0 is normal volume.
getVolumeLimits
(method) love.Source:getVolumeLimits()
-> min: number
2. max: number
Returns the volume limits of the source.
@return min — The minimum volume.
@return max — The maximum volume.
isLooping
(method) love.Source:isLooping()
-> loop: boolean
Returns whether the Source will loop.
@return loop — True if the Source will loop, false otherwise.
isPlaying
(method) love.Source:isPlaying()
-> playing: boolean
Returns whether the Source is playing.
@return playing — True if the Source is playing, false otherwise.
isRelative
(method) love.Source:isRelative()
-> relative: boolean
Gets whether the Source's position, velocity, direction, and cone angles are relative to the listener.
@return relative — True if the position, velocity, direction and cone angles are relative to the listener, false if they're absolute.
pause
(method) love.Source:pause()
Pauses the Source.
play
(method) love.Source:play()
-> success: boolean
Starts playing the Source.
@return success — Whether the Source was able to successfully start playing.
queue
(method) love.Source:queue(sounddata: love.SoundData)
-> success: boolean
Queues SoundData for playback in a queueable Source.
This method requires the Source to be created via love.audio.newQueueableSource.
@param sounddata — The data to queue. The SoundData's sample rate, bit depth, and channel count must match the Source's.
@return success — True if the data was successfully queued for playback, false if there were no available buffers to use for queueing.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
seek
(method) love.Source:seek(offset: number, unit?: "samples"|"seconds")
Sets the currently playing position of the Source.
@param offset — The position to seek to.
@param unit — The unit of the position value.
--
-- Units that represent time.
--
--
-- [Open in Browser](https://love2d.org/wiki/TimeUnit)
--
unit:
| "seconds" -- Regular seconds.
| "samples" -- Audio samples.
setAirAbsorption
(method) love.Source:setAirAbsorption(amount: number)
Sets the amount of air absorption applied to the Source.
By default the value is set to 0 which means that air absorption effects are disabled. A value of 1 will apply high frequency attenuation to the Source at a rate of 0.05 dB per meter.
Air absorption can simulate sound transmission through foggy air, dry air, smoky atmosphere, etc. It can be used to simulate different atmospheric conditions within different locations in an area.
@param amount — The amount of air absorption applied to the Source. Must be between 0 and 10.
setAttenuationDistances
(method) love.Source:setAttenuationDistances(ref: number, max: number)
Sets the reference and maximum attenuation distances of the Source. The parameters, combined with the current DistanceModel, affect how the Source's volume attenuates based on distance.
Distance attenuation is only applicable to Sources based on mono (rather than stereo) audio.
@param ref — The new reference attenuation distance. If the current DistanceModel is clamped, this is the minimum attenuation distance.
@param max — The new maximum attenuation distance.
setCone
(method) love.Source:setCone(innerAngle: number, outerAngle: number, outerVolume?: number)
Sets the Source's directional volume cones. Together with Source:setDirection, the cone angles allow for the Source's volume to vary depending on its direction.
@param innerAngle — The inner angle from the Source's direction, in radians. The Source will play at normal volume if the listener is inside the cone defined by this angle.
@param outerAngle — The outer angle from the Source's direction, in radians. The Source will play at a volume between the normal and outer volumes, if the listener is in between the cones defined by the inner and outer angles.
@param outerVolume — The Source's volume when the listener is outside both the inner and outer cone angles.
setDirection
(method) love.Source:setDirection(x: number, y: number, z: number)
Sets the direction vector of the Source. A zero vector makes the source non-directional.
@param x — The X part of the direction vector.
@param y — The Y part of the direction vector.
@param z — The Z part of the direction vector.
setEffect
(method) love.Source:setEffect(name: string, enable?: boolean)
-> success: boolean
Applies an audio effect to the Source.
The effect must have been previously defined using love.audio.setEffect.
@param name — The name of the effect previously set up with love.audio.setEffect.
@param enable — If false and the given effect name was previously enabled on this Source, disables the effect.
@return success — Whether the effect was successfully applied to this Source.
setFilter
(method) love.Source:setFilter(settings: { type: "bandpass"|"highpass"|"lowpass", volume: number, highgain: number, lowgain: number })
-> success: boolean
Sets a low-pass, high-pass, or band-pass filter to apply when playing the Source.
@param settings — The filter settings to use for this Source, with the following fields:
@return success — Whether the filter was successfully applied to the Source.
setLooping
(method) love.Source:setLooping(loop: boolean)
Sets whether the Source should loop.
@param loop — True if the source should loop, false otherwise.
setPitch
(method) love.Source:setPitch(pitch: number)
Sets the pitch of the Source.
@param pitch — Calculated with regard to 1 being the base pitch. Each reduction by 50 percent equals a pitch shift of -12 semitones (one octave reduction). Each doubling equals a pitch shift of 12 semitones (one octave increase). Zero is not a legal value.
setPosition
(method) love.Source:setPosition(x: number, y: number, z: number)
Sets the position of the Source. Please note that this only works for mono (i.e. non-stereo) sound files!
@param x — The X position of the Source.
@param y — The Y position of the Source.
@param z — The Z position of the Source.
setRelative
(method) love.Source:setRelative(enable?: boolean)
Sets whether the Source's position, velocity, direction, and cone angles are relative to the listener, or absolute.
By default, all sources are absolute and therefore relative to the origin of love's coordinate system 0, 0. Only absolute sources are affected by the position of the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources.
@param enable — True to make the position, velocity, direction and cone angles relative to the listener, false to make them absolute.
setRolloff
(method) love.Source:setRolloff(rolloff: number)
Sets the rolloff factor which affects the strength of the used distance attenuation.
Extended information and detailed formulas can be found in the chapter '3.4. Attenuation By Distance' of OpenAL 1.1 specification.
@param rolloff — The new rolloff factor.
setVelocity
(method) love.Source:setVelocity(x: number, y: number, z: number)
Sets the velocity of the Source.
This does '''not''' change the position of the Source, but lets the application know how it has to calculate the doppler effect.
@param x — The X part of the velocity vector.
@param y — The Y part of the velocity vector.
@param z — The Z part of the velocity vector.
setVolume
(method) love.Source:setVolume(volume: number)
Sets the current volume of the Source.
@param volume — The volume for a Source, where 1.0 is normal volume. Volume cannot be raised above 1.0.
setVolumeLimits
(method) love.Source:setVolumeLimits(min: number, max: number)
Sets the volume limits of the source. The limits have to be numbers from 0 to 1.
@param min — The minimum volume.
@param max — The maximum volume.
stop
(method) love.Source:stop()
Stops a Source.
tell
(method) love.Source:tell(unit?: "samples"|"seconds")
-> position: number
Gets the currently playing position of the Source.
@param unit — The type of unit for the return value.
@return position — The currently playing position of the Source.
--
-- Units that represent time.
--
--
-- [Open in Browser](https://love2d.org/wiki/TimeUnit)
--
unit:
| "seconds" -- Regular seconds.
| "samples" -- Audio samples.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.SourceType
love.SpriteBatch
add
(method) love.SpriteBatch:add(x: number, y: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
-> id: number
Adds a sprite to the batch. Sprites are drawn in the order they are added.
@param x — The position to draw the object (x-axis).
@param y — The position to draw the object (y-axis).
@param r — Orientation (radians).
@param sx — Scale factor (x-axis).
@param sy — Scale factor (y-axis).
@param ox — Origin offset (x-axis).
@param oy — Origin offset (y-axis).
@param kx — Shear factor (x-axis).
@param ky — Shear factor (y-axis).
@return id — An identifier for the added sprite.
addLayer
(method) love.SpriteBatch:addLayer(layerindex: number, x?: number, y?: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
-> spriteindex: number
Adds a sprite to a batch created with an Array Texture.
@param layerindex — The index of the layer to use for this sprite.
@param x — The position to draw the sprite (x-axis).
@param y — The position to draw the sprite (y-axis).
@param r — Orientation (radians).
@param sx — Scale factor (x-axis).
@param sy — Scale factor (y-axis).
@param ox — Origin offset (x-axis).
@param oy — Origin offset (y-axis).
@param kx — Shearing factor (x-axis).
@param ky — Shearing factor (y-axis).
@return spriteindex — The index of the added sprite, for use with SpriteBatch:set or SpriteBatch:setLayer.
attachAttribute
(method) love.SpriteBatch:attachAttribute(name: string, mesh: love.Mesh)
Attaches a per-vertex attribute from a Mesh onto this SpriteBatch, for use when drawing. This can be combined with a Shader to augment a SpriteBatch with per-vertex or additional per-sprite information instead of just having per-sprite colors.
Each sprite in a SpriteBatch has 4 vertices in the following order: top-left, bottom-left, top-right, bottom-right. The index returned by SpriteBatch:add (and used by SpriteBatch:set) can used to determine the first vertex of a specific sprite with the formula 1 + 4 * ( id - 1 ).
@param name — The name of the vertex attribute to attach.
@param mesh — The Mesh to get the vertex attribute from.
clear
(method) love.SpriteBatch:clear()
Removes all sprites from the buffer.
flush
(method) love.SpriteBatch:flush()
Immediately sends all new and modified sprite data in the batch to the graphics card.
Normally it isn't necessary to call this method as love.graphics.draw(spritebatch, ...) will do it automatically if needed, but explicitly using SpriteBatch:flush gives more control over when the work happens.
If this method is used, it generally shouldn't be called more than once (at most) between love.graphics.draw(spritebatch, ...) calls.
getBufferSize
(method) love.SpriteBatch:getBufferSize()
-> size: number
Gets the maximum number of sprites the SpriteBatch can hold.
@return size — The maximum number of sprites the batch can hold.
getColor
(method) love.SpriteBatch:getColor()
-> r: number
2. g: number
3. b: number
4. a: number
Gets the color that will be used for the next add and set operations.
If no color has been set with SpriteBatch:setColor or the current SpriteBatch color has been cleared, this method will return nil.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@return r — The red component (0-1).
@return g — The green component (0-1).
@return b — The blue component (0-1).
@return a — The alpha component (0-1).
getCount
(method) love.SpriteBatch:getCount()
-> count: number
Gets the number of sprites currently in the SpriteBatch.
@return count — The number of sprites currently in the batch.
getTexture
(method) love.SpriteBatch:getTexture()
-> texture: love.Texture
Gets the texture (Image or Canvas) used by the SpriteBatch.
@return texture — The Image or Canvas used by the SpriteBatch.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
set
(method) love.SpriteBatch:set(spriteindex: number, x: number, y: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
Changes a sprite in the batch. This requires the sprite index returned by SpriteBatch:add or SpriteBatch:addLayer.
@param spriteindex — The index of the sprite that will be changed.
@param x — The position to draw the object (x-axis).
@param y — The position to draw the object (y-axis).
@param r — Orientation (radians).
@param sx — Scale factor (x-axis).
@param sy — Scale factor (y-axis).
@param ox — Origin offset (x-axis).
@param oy — Origin offset (y-axis).
@param kx — Shear factor (x-axis).
@param ky — Shear factor (y-axis).
setColor
(method) love.SpriteBatch:setColor(r: number, g: number, b: number, a?: number)
Sets the color that will be used for the next add and set operations. Calling the function without arguments will disable all per-sprite colors for the SpriteBatch.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
In version 0.9.2 and older, the global color set with love.graphics.setColor will not work on the SpriteBatch if any of the sprites has its own color.
@param r — The amount of red.
@param g — The amount of green.
@param b — The amount of blue.
@param a — The amount of alpha.
setDrawRange
(method) love.SpriteBatch:setDrawRange(start: number, count: number)
Restricts the drawn sprites in the SpriteBatch to a subset of the total.
@param start — The index of the first sprite to draw. Index 1 corresponds to the first sprite added with SpriteBatch:add.
@param count — The number of sprites to draw.
setLayer
(method) love.SpriteBatch:setLayer(spriteindex: number, layerindex: number, x?: number, y?: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
Changes a sprite previously added with add or addLayer, in a batch created with an Array Texture.
@param spriteindex — The index of the existing sprite to replace.
@param layerindex — The index of the layer in the Array Texture to use for this sprite.
@param x — The position to draw the sprite (x-axis).
@param y — The position to draw the sprite (y-axis).
@param r — Orientation (radians).
@param sx — Scale factor (x-axis).
@param sy — Scale factor (y-axis).
@param ox — Origin offset (x-axis).
@param oy — Origin offset (y-axis).
@param kx — Shearing factor (x-axis).
@param ky — Shearing factor (y-axis).
setTexture
(method) love.SpriteBatch:setTexture(texture: love.Texture)
Sets the texture (Image or Canvas) used for the sprites in the batch, when drawing.
@param texture — The new Image or Canvas to use for the sprites in the batch.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.SpriteBatchUsage
love.StackType
love.StencilAction
love.Text
add
(method) love.Text:add(textstring: string, x?: number, y?: number, angle?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
-> index: number
Adds additional colored text to the Text object at the specified position.
@param textstring — The text to add to the object.
@param x — The position of the new text on the x-axis.
@param y — The position of the new text on the y-axis.
@param angle — The orientation of the new text in radians.
@param sx — Scale factor on the x-axis.
@param sy — Scale factor on the y-axis.
@param ox — Origin offset on the x-axis.
@param oy — Origin offset on the y-axis.
@param kx — Shearing / skew factor on the x-axis.
@param ky — Shearing / skew factor on the y-axis.
@return index — An index number that can be used with Text:getWidth or Text:getHeight.
addf
(method) love.Text:addf(textstring: string, wraplimit: number, align: "center"|"justify"|"left"|"right", x: number, y: number, angle?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
-> index: number
Adds additional formatted / colored text to the Text object at the specified position.
The word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change.
@param textstring — The text to add to the object.
@param wraplimit — The maximum width in pixels of the text before it gets automatically wrapped to a new line.
@param align — The alignment of the text.
@param x — The position of the new text (x-axis).
@param y — The position of the new text (y-axis).
@param angle — Orientation (radians).
@param sx — Scale factor (x-axis).
@param sy — Scale factor (y-axis).
@param ox — Origin offset (x-axis).
@param oy — Origin offset (y-axis).
@param kx — Shearing / skew factor (x-axis).
@param ky — Shearing / skew factor (y-axis).
@return index — An index number that can be used with Text:getWidth or Text:getHeight.
--
-- Text alignment.
--
--
-- [Open in Browser](https://love2d.org/wiki/AlignMode)
--
align:
| "center" -- Align text center.
| "left" -- Align text left.
| "right" -- Align text right.
| "justify" -- Align text both left and right.
clear
(method) love.Text:clear()
Clears the contents of the Text object.
getDimensions
(method) love.Text:getDimensions()
-> width: number
2. height: number
Gets the width and height of the text in pixels.
@return width — The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned.
@return height — The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned.
getFont
(method) love.Text:getFont()
-> font: love.Font
Gets the Font used with the Text object.
@return font — The font used with this Text object.
getHeight
(method) love.Text:getHeight()
-> height: number
Gets the height of the text in pixels.
@return height — The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned.
getWidth
(method) love.Text:getWidth()
-> width: number
Gets the width of the text in pixels.
@return width — The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
set
(method) love.Text:set(textstring: string)
Replaces the contents of the Text object with a new unformatted string.
@param textstring — The new string of text to use.
setFont
(method) love.Text:setFont(font: love.Font)
Replaces the Font used with the text.
@param font — The new font to use with this Text object.
setf
(method) love.Text:setf(textstring: string, wraplimit: number, align: "center"|"justify"|"left"|"right")
Replaces the contents of the Text object with a new formatted string.
@param textstring — The new string of text to use.
@param wraplimit — The maximum width in pixels of the text before it gets automatically wrapped to a new line.
@param align — The alignment of the text.
--
-- Text alignment.
--
--
-- [Open in Browser](https://love2d.org/wiki/AlignMode)
--
align:
| "center" -- Align text center.
| "left" -- Align text left.
| "right" -- Align text right.
| "justify" -- Align text both left and right.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.Texture
getDPIScale
(method) love.Texture:getDPIScale()
-> dpiscale: number
Gets the DPI scale factor of the Texture.
The DPI scale factor represents relative pixel density. A DPI scale factor of 2 means the texture has twice the pixel density in each dimension (4 times as many pixels in the same area) compared to a texture with a DPI scale factor of 1.
For example, a texture with pixel dimensions of 100x100 with a DPI scale factor of 2 will be drawn as if it was 50x50. This is useful with high-dpi / retina displays to easily allow swapping out higher or lower pixel density Images and Canvases without needing any extra manual scaling logic.
@return dpiscale — The DPI scale factor of the Texture.
getDepth
(method) love.Texture:getDepth()
-> depth: number
Gets the depth of a Volume Texture. Returns 1 for 2D, Cubemap, and Array textures.
@return depth — The depth of the volume Texture.
getDepthSampleMode
(method) love.Texture:getDepthSampleMode()
-> compare: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3)
Gets the comparison mode used when sampling from a depth texture in a shader.
Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D.
@return compare — The comparison mode used when sampling from this texture in a shader, or nil if setDepthSampleMode has not been called on this Texture.
--
-- Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompareMode)
--
compare:
| "equal" -- * stencil tests: the stencil value of the pixel must be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.
| "notequal" -- * stencil tests: the stencil value of the pixel must not be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel.
| "less" -- * stencil tests: the stencil value of the pixel must be less than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.
| "lequal" -- * stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.
| "gequal" -- * stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.
| "greater" -- * stencil tests: the stencil value of the pixel must be greater than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.
| "never" -- Objects will never be drawn.
| "always" -- Objects will always be drawn. Effectively disables the depth or stencil test.
getDimensions
(method) love.Texture:getDimensions()
-> width: number
2. height: number
Gets the width and height of the Texture.
@return width — The width of the Texture.
@return height — The height of the Texture.
getFilter
(method) love.Texture:getFilter()
-> min: "linear"|"nearest"
2. mag: "linear"|"nearest"
3. anisotropy: number
Gets the filter mode of the Texture.
@return min — Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels).
@return mag — Filter mode to use when magnifying the texture (rendering it at a smaller size on-screen than its size in pixels).
@return anisotropy — Maximum amount of anisotropic filtering used.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
getFormat
(method) love.Texture:getFormat()
-> format: "ASTC10x10"|"ASTC10x5"|"ASTC10x6"|"ASTC10x8"|"ASTC12x10"...(+59)
Gets the pixel format of the Texture.
@return format — The pixel format the Texture was created with.
--
-- Pixel formats for Textures, ImageData, and CompressedImageData.
--
--
-- [Open in Browser](https://love2d.org/wiki/PixelFormat)
--
format:
| "unknown" -- Indicates unknown pixel format, used internally.
| "normal" -- Alias for rgba8, or srgba8 if gamma-correct rendering is enabled.
| "hdr" -- A format suitable for high dynamic range content - an alias for the rgba16f format, normally.
| "r8" -- Single-channel (red component) format (8 bpp).
| "rg8" -- Two channels (red and green components) with 8 bits per channel (16 bpp).
| "rgba8" -- 8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders).
| "srgba8" -- gamma-correct version of rgba8.
| "r16" -- Single-channel (red component) format (16 bpp).
| "rg16" -- Two channels (red and green components) with 16 bits per channel (32 bpp).
| "rgba16" -- 16 bits per channel (64 bpp) RGBA. Color channel values range from 0-65535 (0-1 in shaders).
| "r16f" -- Floating point single-channel format (16 bpp). Color values can range from [-65504, +65504].
| "rg16f" -- Floating point two-channel format with 16 bits per channel (32 bpp). Color values can range from [-65504, +65504].
| "rgba16f" -- Floating point RGBA with 16 bits per channel (64 bpp). Color values can range from [-65504, +65504].
| "r32f" -- Floating point single-channel format (32 bpp).
| "rg32f" -- Floating point two-channel format with 32 bits per channel (64 bpp).
| "rgba32f" -- Floating point RGBA with 32 bits per channel (128 bpp).
| "la8" -- Same as rg8, but accessed as (L, L, L, A)
| "rgba4" -- 4 bits per channel (16 bpp) RGBA.
| "rgb5a1" -- RGB with 5 bits each, and a 1-bit alpha channel (16 bpp).
| "rgb565" -- RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format.
| "rgb10a2" -- RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp).
| "rg11b10f" -- Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp). There is no alpha channel. Color values can range from [0, +65024].
| "stencil8" -- No depth buffer and 8-bit stencil buffer.
| "depth16" -- 16-bit depth buffer and no stencil buffer.
| "depth24" -- 24-bit depth buffer and no stencil buffer.
| "depth32f" -- 32-bit float depth buffer and no stencil buffer.
| "depth24stencil8" -- 24-bit depth buffer and 8-bit stencil buffer.
| "depth32fstencil8" -- 32-bit float depth buffer and 8-bit stencil buffer.
| "DXT1" -- The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems.
| "DXT3" -- The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.
| "DXT5" -- The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems.
| "BC4" -- The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
| "BC4s" -- The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "BC5" -- The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
| "BC5s" -- The signed variant of the BC5 format.
| "BC6h" -- The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems.
| "BC6hs" -- The signed variant of the BC6H format. Stores RGB data in the range of +65504.
| "BC7" -- The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.
| "ETC1" -- The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.
| "ETC2rgb" -- The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.
| "ETC2rgba" -- The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.
| "ETC2rgba1" -- The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.
| "EACr" -- The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.
| "EACrs" -- The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
| "EACrg" -- The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.
| "EACrgs" -- The signed two-channel variant of the EAC format.
| "PVR1rgb2" -- The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized.
| "PVR1rgb4" -- The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.
| "PVR1rgba2" -- The 2 bit per pixel RGBA variant of the PVRTC1 format.
| "PVR1rgba4" -- The 4 bit per pixel RGBA variant of the PVRTC1 format.
| "ASTC4x4" -- The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.
| "ASTC5x4" -- The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.
| "ASTC5x5" -- The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.
| "ASTC6x5" -- The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.
| "ASTC6x6" -- The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.
| "ASTC8x5" -- The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.
| "ASTC8x6" -- The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.
| "ASTC8x8" -- The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.
| "ASTC10x5" -- The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.
| "ASTC10x6" -- The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.
| "ASTC10x8" -- The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.
| "ASTC10x10" -- The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.
| "ASTC12x10" -- The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.
| "ASTC12x12" -- The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.
getHeight
(method) love.Texture:getHeight()
-> height: number
Gets the height of the Texture.
@return height — The height of the Texture.
getLayerCount
(method) love.Texture:getLayerCount()
-> layers: number
Gets the number of layers / slices in an Array Texture. Returns 1 for 2D, Cubemap, and Volume textures.
@return layers — The number of layers in the Array Texture.
getMipmapCount
(method) love.Texture:getMipmapCount()
-> mipmaps: number
Gets the number of mipmaps contained in the Texture. If the texture was not created with mipmaps, it will return 1.
@return mipmaps — The number of mipmaps in the Texture.
getMipmapFilter
(method) love.Texture:getMipmapFilter()
-> mode: "linear"|"nearest"
2. sharpness: number
Gets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images.
@return mode — The filter mode used in between mipmap levels. nil if mipmap filtering is not enabled.
@return sharpness — Value used to determine whether the image should use more or less detailed mipmap levels than normal when drawing.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mode:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
getPixelDimensions
(method) love.Texture:getPixelDimensions()
-> pixelwidth: number
2. pixelheight: number
Gets the width and height in pixels of the Texture.
Texture:getDimensions gets the dimensions of the texture in units scaled by the texture's DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelDimensions only when dealing specifically with pixels, for example when using Canvas:newImageData.
@return pixelwidth — The width of the Texture, in pixels.
@return pixelheight — The height of the Texture, in pixels.
getPixelHeight
(method) love.Texture:getPixelHeight()
-> pixelheight: number
Gets the height in pixels of the Texture.
DPI scale factor, rather than pixels. Use getHeight for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelHeight only when dealing specifically with pixels, for example when using Canvas:newImageData.
@return pixelheight — The height of the Texture, in pixels.
getPixelWidth
(method) love.Texture:getPixelWidth()
-> pixelwidth: number
Gets the width in pixels of the Texture.
DPI scale factor, rather than pixels. Use getWidth for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelWidth only when dealing specifically with pixels, for example when using Canvas:newImageData.
@return pixelwidth — The width of the Texture, in pixels.
getTextureType
(method) love.Texture:getTextureType()
-> texturetype: "2d"|"array"|"cube"|"volume"
Gets the type of the Texture.
@return texturetype — The type of the Texture.
--
-- Types of textures (2D, cubemap, etc.)
--
--
-- [Open in Browser](https://love2d.org/wiki/TextureType)
--
texturetype:
| "2d" -- Regular 2D texture with width and height.
| "array" -- Several same-size 2D textures organized into a single object. Similar to a texture atlas / sprite sheet, but avoids sprite bleeding and other issues.
| "cube" -- Cubemap texture with 6 faces. Requires a custom shader (and Shader:send) to use. Sampling from a cube texture in a shader takes a 3D direction vector instead of a texture coordinate.
| "volume" -- 3D texture with width, height, and depth. Requires a custom shader to use. Volume textures can have texture filtering applied along the 3rd axis.
getWidth
(method) love.Texture:getWidth()
-> width: number
Gets the width of the Texture.
@return width — The width of the Texture.
getWrap
(method) love.Texture:getWrap()
-> horiz: "clamp"|"clampzero"|"mirroredrepeat"|"repeat"
2. vert: "clamp"|"clampzero"|"mirroredrepeat"|"repeat"
3. depth: "clamp"|"clampzero"|"mirroredrepeat"|"repeat"
Gets the wrapping properties of a Texture.
This function returns the currently set horizontal and vertical wrapping modes for the texture.
@return horiz — Horizontal wrapping mode of the texture.
@return vert — Vertical wrapping mode of the texture.
@return depth — Wrapping mode for the z-axis of a Volume texture.
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
horiz:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
vert:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
depth:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
isReadable
(method) love.Texture:isReadable()
-> readable: boolean
Gets whether the Texture can be drawn and sent to a Shader.
Canvases created with stencil and/or depth PixelFormats are not readable by default, unless readable=true is specified in the settings table passed into love.graphics.newCanvas.
Non-readable Canvases can still be rendered to.
@return readable — Whether the Texture is readable.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setDepthSampleMode
(method) love.Texture:setDepthSampleMode(compare: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3))
Sets the comparison mode used when sampling from a depth texture in a shader. Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D.
When using a depth texture with a comparison mode set in a shader, it must be declared as a sampler2DShadow and used in a GLSL 3 Shader. The result of accessing the texture in the shader will return a float between 0 and 1, proportional to the number of samples (up to 4 samples will be used if bilinear filtering is enabled) that passed the test set by the comparison operation.
Depth texture comparison can only be used with readable depth-formatted Canvases.
@param compare — The comparison mode used when sampling from this texture in a shader.
--
-- Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompareMode)
--
compare:
| "equal" -- * stencil tests: the stencil value of the pixel must be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.
| "notequal" -- * stencil tests: the stencil value of the pixel must not be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel.
| "less" -- * stencil tests: the stencil value of the pixel must be less than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.
| "lequal" -- * stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.
| "gequal" -- * stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.
| "greater" -- * stencil tests: the stencil value of the pixel must be greater than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.
| "never" -- Objects will never be drawn.
| "always" -- Objects will always be drawn. Effectively disables the depth or stencil test.
setFilter
(method) love.Texture:setFilter(min: "linear"|"nearest", mag?: "linear"|"nearest", anisotropy?: number)
Sets the filter mode of the Texture.
@param min — Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels).
@param mag — Filter mode to use when magnifying the texture (rendering it at a larger size on-screen than its size in pixels).
@param anisotropy — Maximum amount of anisotropic filtering to use.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
setMipmapFilter
(method) love.Texture:setMipmapFilter(filtermode: "linear"|"nearest", sharpness?: number)
Sets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images.
Mipmapping is useful when drawing a texture at a reduced scale. It can improve performance and reduce aliasing issues.
In created with the mipmaps flag enabled for the mipmap filter to have any effect. In versions prior to 0.10.0 it's best to call this method directly after creating the image with love.graphics.newImage, to avoid bugs in certain graphics drivers.
Due to hardware restrictions and driver bugs, in versions prior to 0.10.0 images that weren't loaded from a CompressedData must have power-of-two dimensions (64x64, 512x256, etc.) to use mipmaps.
@param filtermode — The filter mode to use in between mipmap levels. 'nearest' will often give better performance.
@param sharpness — A positive sharpness value makes the texture use a more detailed mipmap level when drawing, at the expense of performance. A negative value does the reverse.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
filtermode:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
setWrap
(method) love.Texture:setWrap(horiz: "clamp"|"clampzero"|"mirroredrepeat"|"repeat", vert?: "clamp"|"clampzero"|"mirroredrepeat"|"repeat", depth?: "clamp"|"clampzero"|"mirroredrepeat"|"repeat")
Sets the wrapping properties of a Texture.
This function sets the way a Texture is repeated when it is drawn with a Quad that is larger than the texture's extent, or when a custom Shader is used which uses texture coordinates outside of [0, 1]. A texture may be clamped or set to repeat in both horizontal and vertical directions.
Clamped textures appear only once (with the edges of the texture stretching to fill the extent of the Quad), whereas repeated ones repeat as many times as there is room in the Quad.
@param horiz — Horizontal wrapping mode of the texture.
@param vert — Vertical wrapping mode of the texture.
@param depth — Wrapping mode for the z-axis of a Volume texture.
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
horiz:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
vert:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
--
-- How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.
--
--
-- [Open in Browser](https://love2d.org/wiki/WrapMode)
--
depth:
| "clamp" -- Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture.
| "repeat" -- Repeat the texture. Fills the whole available extent.
| "mirroredrepeat" -- Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.
| "clampzero" -- Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.TextureType
love.Thread
getError
(method) love.Thread:getError()
-> err: string
Retrieves the error string from the thread if it produced an error.
@return err — The error message, or nil if the Thread has not caused an error.
isRunning
(method) love.Thread:isRunning()
-> value: boolean
Returns whether the thread is currently running.
Threads which are not running can be (re)started with Thread:start.
@return value — True if the thread is running, false otherwise.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
start
(method) love.Thread:start()
Starts the thread.
Beginning with version 0.9.0, threads can be restarted after they have completed their execution.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
wait
(method) love.Thread:wait()
Wait for a thread to finish.
This call will block until the thread finishes.
love.TimeUnit
love.Transform
apply
(method) love.Transform:apply(other: love.Transform)
-> transform: love.Transform
Applies the given other Transform object to this one.
This effectively multiplies this Transform's internal transformation matrix with the other Transform's (i.e. self * other), and stores the result in this object.
@param other — The other Transform object to apply to this Transform.
@return transform — The Transform object the method was called on. Allows easily chaining Transform methods.
clone
(method) love.Transform:clone()
-> clone: love.Transform
Creates a new copy of this Transform.
@return clone — The copy of this Transform.
getMatrix
(method) love.Transform:getMatrix()
-> e1_1: number
2. e1_2: number
3. e1_3: number
4. e1_4: number
5. e2_1: number
6. e2_2: number
7. e2_3: number
8. e2_4: number
9. e3_1: number
10. e3_2: number
11. e3_3: number
12. e3_4: number
13. e4_1: number
14. e4_2: number
15. e4_3: number
16. e4_4: number
Gets the internal 4x4 transformation matrix stored by this Transform. The matrix is returned in row-major order.
@return e1_1 — The first column of the first row of the matrix.
@return e1_2 — The second column of the first row of the matrix.
@return e1_3 — The third column of the first row of the matrix.
@return e1_4 — The fourth column of the first row of the matrix.
@return e2_1 — The first column of the second row of the matrix.
@return e2_2 — The second column of the second row of the matrix.
@return e2_3 — The third column of the second row of the matrix.
@return e2_4 — The fourth column of the second row of the matrix.
@return e3_1 — The first column of the third row of the matrix.
@return e3_2 — The second column of the third row of the matrix.
@return e3_3 — The third column of the third row of the matrix.
@return e3_4 — The fourth column of the third row of the matrix.
@return e4_1 — The first column of the fourth row of the matrix.
@return e4_2 — The second column of the fourth row of the matrix.
@return e4_3 — The third column of the fourth row of the matrix.
@return e4_4 — The fourth column of the fourth row of the matrix.
inverse
(method) love.Transform:inverse()
-> inverse: love.Transform
Creates a new Transform containing the inverse of this Transform.
@return inverse — A new Transform object representing the inverse of this Transform's matrix.
inverseTransformPoint
(method) love.Transform:inverseTransformPoint(localX: number, localY: number)
-> globalX: number
2. globalY: number
Applies the reverse of the Transform object's transformation to the given 2D position.
This effectively converts the given position from the local coordinate space of the Transform into global coordinates.
One use of this method can be to convert a screen-space mouse position into global world coordinates, if the given Transform has transformations applied that are used for a camera system in-game.
@param localX — The x component of the position with the transform applied.
@param localY — The y component of the position with the transform applied.
@return globalX — The x component of the position in global coordinates.
@return globalY — The y component of the position in global coordinates.
isAffine2DTransform
(method) love.Transform:isAffine2DTransform()
-> affine: boolean
Checks whether the Transform is an affine transformation.
@return affine — true if the transform object is an affine transformation, false otherwise.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
reset
(method) love.Transform:reset()
-> transform: love.Transform
Resets the Transform to an identity state. All previously applied transformations are erased.
@return transform — The Transform object the method was called on. Allows easily chaining Transform methods.
rotate
(method) love.Transform:rotate(angle: number)
-> transform: love.Transform
Applies a rotation to the Transform's coordinate system. This method does not reset any previously applied transformations.
@param angle — The relative angle in radians to rotate this Transform by.
@return transform — The Transform object the method was called on. Allows easily chaining Transform methods.
scale
(method) love.Transform:scale(sx: number, sy?: number)
-> transform: love.Transform
Scales the Transform's coordinate system. This method does not reset any previously applied transformations.
@param sx — The relative scale factor along the x-axis.
@param sy — The relative scale factor along the y-axis.
@return transform — The Transform object the method was called on. Allows easily chaining Transform methods.
setMatrix
(method) love.Transform:setMatrix(e1_1: number, e1_2: number, e1_3: number, e1_4: number, e2_1: number, e2_2: number, e2_3: number, e2_4: number, e3_1: number, e3_2: number, e3_3: number, e3_4: number, e4_1: number, e4_2: number, e4_3: number, e4_4: number)
-> transform: love.Transform
Directly sets the Transform's internal 4x4 transformation matrix.
@param e1_1 — The first column of the first row of the matrix.
@param e1_2 — The second column of the first row of the matrix.
@param e1_3 — The third column of the first row of the matrix.
@param e1_4 — The fourth column of the first row of the matrix.
@param e2_1 — The first column of the second row of the matrix.
@param e2_2 — The second column of the second row of the matrix.
@param e2_3 — The third column of the second row of the matrix.
@param e2_4 — The fourth column of the second row of the matrix.
@param e3_1 — The first column of the third row of the matrix.
@param e3_2 — The second column of the third row of the matrix.
@param e3_3 — The third column of the third row of the matrix.
@param e3_4 — The fourth column of the third row of the matrix.
@param e4_1 — The first column of the fourth row of the matrix.
@param e4_2 — The second column of the fourth row of the matrix.
@param e4_3 — The third column of the fourth row of the matrix.
@param e4_4 — The fourth column of the fourth row of the matrix.
@return transform — The Transform object the method was called on. Allows easily chaining Transform methods.
setTransformation
(method) love.Transform:setTransformation(x: number, y: number, angle?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
-> transform: love.Transform
Resets the Transform to the specified transformation parameters.
@param x — The position of the Transform on the x-axis.
@param y — The position of the Transform on the y-axis.
@param angle — The orientation of the Transform in radians.
@param sx — Scale factor on the x-axis.
@param sy — Scale factor on the y-axis.
@param ox — Origin offset on the x-axis.
@param oy — Origin offset on the y-axis.
@param kx — Shearing / skew factor on the x-axis.
@param ky — Shearing / skew factor on the y-axis.
@return transform — The Transform object the method was called on. Allows easily chaining Transform methods.
shear
(method) love.Transform:shear(kx: number, ky: number)
-> transform: love.Transform
Applies a shear factor (skew) to the Transform's coordinate system. This method does not reset any previously applied transformations.
@param kx — The shear factor along the x-axis.
@param ky — The shear factor along the y-axis.
@return transform — The Transform object the method was called on. Allows easily chaining Transform methods.
transformPoint
(method) love.Transform:transformPoint(globalX: number, globalY: number)
-> localX: number
2. localY: number
Applies the Transform object's transformation to the given 2D position.
This effectively converts the given position from global coordinates into the local coordinate space of the Transform.
@param globalX — The x component of the position in global coordinates.
@param globalY — The y component of the position in global coordinates.
@return localX — The x component of the position with the transform applied.
@return localY — The y component of the position with the transform applied.
translate
(method) love.Transform:translate(dx: number, dy: number)
-> transform: love.Transform
Applies a translation to the Transform's coordinate system. This method does not reset any previously applied transformations.
@param dx — The relative translation along the x-axis.
@param dy — The relative translation along the y-axis.
@return transform — The Transform object the method was called on. Allows easily chaining Transform methods.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.VertexAttributeStep
love.VertexWinding
love.Video
getDimensions
(method) love.Video:getDimensions()
-> width: number
2. height: number
Gets the width and height of the Video in pixels.
@return width — The width of the Video.
@return height — The height of the Video.
getFilter
(method) love.Video:getFilter()
-> min: "linear"|"nearest"
2. mag: "linear"|"nearest"
3. anisotropy: number
Gets the scaling filters used when drawing the Video.
@return min — The filter mode used when scaling the Video down.
@return mag — The filter mode used when scaling the Video up.
@return anisotropy — Maximum amount of anisotropic filtering used.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
getHeight
(method) love.Video:getHeight()
-> height: number
Gets the height of the Video in pixels.
@return height — The height of the Video.
getSource
(method) love.Video:getSource()
-> source: love.Source
Gets the audio Source used for playing back the video's audio. May return nil if the video has no audio, or if Video:setSource is called with a nil argument.
@return source — The audio Source used for audio playback, or nil if the video has no audio.
getStream
(method) love.Video:getStream()
-> stream: love.VideoStream
Gets the VideoStream object used for decoding and controlling the video.
@return stream — The VideoStream used for decoding and controlling the video.
getWidth
(method) love.Video:getWidth()
-> width: number
Gets the width of the Video in pixels.
@return width — The width of the Video.
isPlaying
(method) love.Video:isPlaying()
-> playing: boolean
Gets whether the Video is currently playing.
@return playing — Whether the video is playing.
pause
(method) love.Video:pause()
Pauses the Video.
play
(method) love.Video:play()
Starts playing the Video. In order for the video to appear onscreen it must be drawn with love.graphics.draw.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
rewind
(method) love.Video:rewind()
Rewinds the Video to the beginning.
seek
(method) love.Video:seek(offset: number)
Sets the current playback position of the Video.
@param offset — The time in seconds since the beginning of the Video.
setFilter
(method) love.Video:setFilter(min: "linear"|"nearest", mag: "linear"|"nearest", anisotropy?: number)
Sets the scaling filters used when drawing the Video.
@param min — The filter mode used when scaling the Video down.
@param mag — The filter mode used when scaling the Video up.
@param anisotropy — Maximum amount of anisotropic filtering used.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
setSource
(method) love.Video:setSource(source?: love.Source)
Sets the audio Source used for playing back the video's audio. The audio Source also controls playback speed and synchronization.
@param source — The audio Source used for audio playback, or nil to disable audio synchronization.
tell
(method) love.Video:tell()
-> seconds: number
Gets the current playback position of the Video.
@return seconds — The time in seconds since the beginning of the Video.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.VideoStream
getFilename
(method) love.VideoStream:getFilename()
-> filename: string
Gets the filename of the VideoStream.
@return filename — The filename of the VideoStream
isPlaying
(method) love.VideoStream:isPlaying()
-> playing: boolean
Gets whether the VideoStream is playing.
@return playing — Whether the VideoStream is playing.
pause
(method) love.VideoStream:pause()
Pauses the VideoStream.
play
(method) love.VideoStream:play()
Plays the VideoStream.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
rewind
(method) love.VideoStream:rewind()
Rewinds the VideoStream. Synonym to VideoStream:seek(0).
seek
(method) love.VideoStream:seek(offset: number)
Sets the current playback position of the VideoStream.
@param offset — The time in seconds since the beginning of the VideoStream.
tell
(method) love.VideoStream:tell()
-> seconds: number
Gets the current playback position of the VideoStream.
@return seconds — The number of seconds sionce the beginning of the VideoStream.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.WeldJoint
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getDampingRatio
(method) love.WeldJoint:getDampingRatio()
-> ratio: number
Returns the damping ratio of the joint.
@return ratio — The damping ratio.
getFrequency
(method) love.WeldJoint:getFrequency()
-> freq: number
Returns the frequency.
@return freq — The frequency in hertz.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getReferenceAngle
(method) love.WeldJoint:getReferenceAngle()
-> angle: number
Gets the reference angle.
@return angle — The reference angle in radians.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setDampingRatio
(method) love.WeldJoint:setDampingRatio(ratio: number)
Sets a new damping ratio.
@param ratio — The new damping ratio.
setFrequency
(method) love.WeldJoint:setFrequency(freq: number)
Sets a new frequency.
@param freq — The new frequency in hertz.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.WheelJoint
destroy
(method) love.Joint:destroy()
Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.
In 0.7.2, when you don't have time to wait for garbage collection, this function
may be used to free the object immediately.
getAnchors
(method) love.Joint:getAnchors()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the anchor points of the joint.
@return x1 — The x-component of the anchor on Body 1.
@return y1 — The y-component of the anchor on Body 1.
@return x2 — The x-component of the anchor on Body 2.
@return y2 — The y-component of the anchor on Body 2.
getAxis
(method) love.WheelJoint:getAxis()
-> x: number
2. y: number
Gets the world-space axis vector of the Wheel Joint.
@return x — The x-axis coordinate of the world-space axis vector.
@return y — The y-axis coordinate of the world-space axis vector.
getBodies
(method) love.Joint:getBodies()
-> bodyA: love.Body
2. bodyB: love.Body
Gets the bodies that the Joint is attached to.
@return bodyA — The first Body.
@return bodyB — The second Body.
getCollideConnected
(method) love.Joint:getCollideConnected()
-> c: boolean
Gets whether the connected Bodies collide.
@return c — True if they collide, false otherwise.
getJointSpeed
(method) love.WheelJoint:getJointSpeed()
-> speed: number
Returns the current joint translation speed.
@return speed — The translation speed of the joint in meters per second.
getJointTranslation
(method) love.WheelJoint:getJointTranslation()
-> position: number
Returns the current joint translation.
@return position — The translation of the joint in meters.
getMaxMotorTorque
(method) love.WheelJoint:getMaxMotorTorque()
-> maxTorque: number
Returns the maximum motor torque.
@return maxTorque — The maximum torque of the joint motor in newton meters.
getMotorSpeed
(method) love.WheelJoint:getMotorSpeed()
-> speed: number
Returns the speed of the motor.
@return speed — The speed of the joint motor in radians per second.
getMotorTorque
(method) love.WheelJoint:getMotorTorque(invdt: number)
-> torque: number
Returns the current torque on the motor.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The torque on the motor in newton meters.
getReactionForce
(method) love.Joint:getReactionForce(x: number)
-> x: number
2. y: number
Returns the reaction force in newtons on the second body
@param x — How long the force applies. Usually the inverse time step or 1/dt.
@return x — The x-component of the force.
@return y — The y-component of the force.
getReactionTorque
(method) love.Joint:getReactionTorque(invdt: number)
-> torque: number
Returns the reaction torque on the second body.
@param invdt — How long the force applies. Usually the inverse time step or 1/dt.
@return torque — The reaction torque on the second body.
getSpringDampingRatio
(method) love.WheelJoint:getSpringDampingRatio()
-> ratio: number
Returns the damping ratio.
@return ratio — The damping ratio.
getSpringFrequency
(method) love.WheelJoint:getSpringFrequency()
-> freq: number
Returns the spring frequency.
@return freq — The frequency in hertz.
getType
(method) love.Joint:getType()
-> type: "distance"|"friction"|"gear"|"mouse"|"prismatic"...(+4)
Gets a string representing the type.
@return type — A string with the name of the Joint type.
--
-- Different types of joints.
--
--
-- [Open in Browser](https://love2d.org/wiki/JointType)
--
type:
| "distance" -- A DistanceJoint.
| "friction" -- A FrictionJoint.
| "gear" -- A GearJoint.
| "mouse" -- A MouseJoint.
| "prismatic" -- A PrismaticJoint.
| "pulley" -- A PulleyJoint.
| "revolute" -- A RevoluteJoint.
| "rope" -- A RopeJoint.
| "weld" -- A WeldJoint.
getUserData
(method) love.Joint:getUserData()
-> value: any
Returns the Lua value associated with this Joint.
@return value — The Lua value associated with the Joint.
isDestroyed
(method) love.Joint:isDestroyed()
-> destroyed: boolean
Gets whether the Joint is destroyed. Destroyed joints cannot be used.
@return destroyed — Whether the Joint is destroyed.
isMotorEnabled
(method) love.WheelJoint:isMotorEnabled()
-> on: boolean
Checks if the joint motor is running.
@return on — The status of the joint motor.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setMaxMotorTorque
(method) love.WheelJoint:setMaxMotorTorque(maxTorque: number)
Sets a new maximum motor torque.
@param maxTorque — The new maximum torque for the joint motor in newton meters.
setMotorEnabled
(method) love.WheelJoint:setMotorEnabled(enable: boolean)
Starts and stops the joint motor.
@param enable — True turns the motor on and false turns it off.
setMotorSpeed
(method) love.WheelJoint:setMotorSpeed(speed: number)
Sets a new speed for the motor.
@param speed — The new speed for the joint motor in radians per second.
setSpringDampingRatio
(method) love.WheelJoint:setSpringDampingRatio(ratio: number)
Sets a new damping ratio.
@param ratio — The new damping ratio.
setSpringFrequency
(method) love.WheelJoint:setSpringFrequency(freq: number)
Sets a new spring frequency.
@param freq — The new frequency in hertz.
setUserData
(method) love.Joint:setUserData(value: any)
Associates a Lua value with the Joint.
To delete the reference, explicitly pass nil.
@param value — The Lua value to associate with the Joint.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
love.World
destroy
(method) love.World:destroy()
Destroys the world, taking all bodies, joints, fixtures and their shapes with it.
An error will occur if you attempt to use any of the destroyed objects after calling this function.
getBodies
(method) love.World:getBodies()
-> bodies: table
Returns a table with all bodies.
@return bodies — A sequence with all bodies.
getBodyCount
(method) love.World:getBodyCount()
-> n: number
Returns the number of bodies in the world.
@return n — The number of bodies in the world.
getCallbacks
(method) love.World:getCallbacks()
-> beginContact: function
2. endContact: function
3. preSolve: function
4. postSolve: function
Returns functions for the callbacks during the world update.
@return beginContact — Gets called when two fixtures begin to overlap.
@return endContact — Gets called when two fixtures cease to overlap.
@return preSolve — Gets called before a collision gets resolved.
@return postSolve — Gets called after the collision has been resolved.
getContactCount
(method) love.World:getContactCount()
-> n: number
Returns the number of contacts in the world.
@return n — The number of contacts in the world.
getContactFilter
(method) love.World:getContactFilter()
-> contactFilter: function
Returns the function for collision filtering.
@return contactFilter — The function that handles the contact filtering.
getContacts
(method) love.World:getContacts()
-> contacts: table
Returns a table with all Contacts.
@return contacts — A sequence with all Contacts.
getGravity
(method) love.World:getGravity()
-> x: number
2. y: number
Get the gravity of the world.
@return x — The x component of gravity.
@return y — The y component of gravity.
getJointCount
(method) love.World:getJointCount()
-> n: number
Returns the number of joints in the world.
@return n — The number of joints in the world.
getJoints
(method) love.World:getJoints()
-> joints: table
Returns a table with all joints.
@return joints — A sequence with all joints.
isDestroyed
(method) love.World:isDestroyed()
-> destroyed: boolean
Gets whether the World is destroyed. Destroyed worlds cannot be used.
@return destroyed — Whether the World is destroyed.
isLocked
(method) love.World:isLocked()
-> locked: boolean
Returns if the world is updating its state.
This will return true inside the callbacks from World:setCallbacks.
@return locked — Will be true if the world is in the process of updating its state.
isSleepingAllowed
(method) love.World:isSleepingAllowed()
-> allow: boolean
Gets the sleep behaviour of the world.
@return allow — True if bodies in the world are allowed to sleep, or false if not.
queryBoundingBox
(method) love.World:queryBoundingBox(topLeftX: number, topLeftY: number, bottomRightX: number, bottomRightY: number, callback: function)
Calls a function for each fixture inside the specified area by searching for any overlapping bounding box (Fixture:getBoundingBox).
@param topLeftX — The x position of the top-left point.
@param topLeftY — The y position of the top-left point.
@param bottomRightX — The x position of the bottom-right point.
@param bottomRightY — The y position of the bottom-right point.
@param callback — This function gets passed one argument, the fixture, and should return a boolean. The search will continue if it is true or stop if it is false.
rayCast
(method) love.World:rayCast(x1: number, y1: number, x2: number, y2: number, callback: function)
Casts a ray and calls a function for each fixtures it intersects.
@param x1 — The x position of the starting point of the ray.
@param y1 — The x position of the starting point of the ray.
@param x2 — The x position of the end point of the ray.
@param y2 — The x value of the surface normal vector of the shape edge.
@param callback — A function called for each fixture intersected by the ray. The function gets six arguments and should return a number as a control value. The intersection points fed into the function will be in an arbitrary order. If you wish to find the closest point of intersection, you'll need to do that yourself within the function. The easiest way to do that is by using the fraction value.
release
(method) love.Object:release()
-> success: boolean
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
@return success — True if the object was released by this call, false if it had been previously released.
setCallbacks
(method) love.World:setCallbacks(beginContact: function, endContact: function, preSolve?: function, postSolve?: function)
Sets functions for the collision callbacks during the world update.
Four Lua functions can be given as arguments. The value nil removes a function.
When called, each function will be passed three arguments. The first two arguments are the colliding fixtures and the third argument is the Contact between them. The postSolve callback additionally gets the normal and tangent impulse for each contact point. See notes.
If you are interested to know when exactly each callback is called, consult a Box2d manual
@param beginContact — Gets called when two fixtures begin to overlap.
@param endContact — Gets called when two fixtures cease to overlap. This will also be called outside of a world update, when colliding objects are destroyed.
@param preSolve — Gets called before a collision gets resolved.
@param postSolve — Gets called after the collision has been resolved.
setContactFilter
(method) love.World:setContactFilter(filter: function)
Sets a function for collision filtering.
If the group and category filtering doesn't generate a collision decision, this function gets called with the two fixtures as arguments. The function should return a boolean value where true means the fixtures will collide and false means they will pass through each other.
@param filter — The function handling the contact filtering.
setGravity
(method) love.World:setGravity(x: number, y: number)
Set the gravity of the world.
@param x — The x component of gravity.
@param y — The y component of gravity.
setSleepingAllowed
(method) love.World:setSleepingAllowed(allow: boolean)
Sets the sleep behaviour of the world.
@param allow — True if bodies in the world are allowed to sleep, or false if not.
translateOrigin
(method) love.World:translateOrigin(x: number, y: number)
Translates the World's origin. Useful in large worlds where floating point precision issues become noticeable at far distances from the origin.
@param x — The x component of the new origin with respect to the old origin.
@param y — The y component of the new origin with respect to the old origin.
type
(method) love.Object:type()
-> type: string
Gets the type of the object as a string.
@return type — The type as a string.
typeOf
(method) love.Object:typeOf(name: string)
-> b: boolean
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
@param name — The name of the type to check for.
@return b — True if the object is of the specified type, false otherwise.
update
(method) love.World:update(dt: number, velocityiterations?: number, positioniterations?: number)
Update the state of the world.
@param dt — The time (in seconds) to advance the physics simulation.
@param velocityiterations — The maximum number of steps used to determine the new velocities when resolving a collision.
@param positioniterations — The maximum number of steps used to determine the new positions when resolving a collision.
love.WrapMode
love.audio
love.audio
love.audio
getActiveEffects
function love.audio.getActiveEffects()
-> effects: table
Gets a list of the names of the currently enabled effects.
@return effects — The list of the names of the currently enabled effects.
getActiveSourceCount
function love.audio.getActiveSourceCount()
-> count: number
Gets the current number of simultaneously playing sources.
@return count — The current number of simultaneously playing sources.
getDistanceModel
function love.audio.getDistanceModel()
-> model: "exponent"|"exponentclamped"|"inverse"|"inverseclamped"|"linear"...(+2)
Returns the distance attenuation model.
@return model — The current distance model. The default is 'inverseclamped'.
--
-- The different distance models.
--
-- Extended information can be found in the chapter "3.4. Attenuation By Distance" of the OpenAL 1.1 specification.
--
--
-- [Open in Browser](https://love2d.org/wiki/DistanceModel)
--
model:
| "none" -- Sources do not get attenuated.
| "inverse" -- Inverse distance attenuation.
| "inverseclamped" -- Inverse distance attenuation. Gain is clamped. In version 0.9.2 and older this is named '''inverse clamped'''.
| "linear" -- Linear attenuation.
| "linearclamped" -- Linear attenuation. Gain is clamped. In version 0.9.2 and older this is named '''linear clamped'''.
| "exponent" -- Exponential attenuation.
| "exponentclamped" -- Exponential attenuation. Gain is clamped. In version 0.9.2 and older this is named '''exponent clamped'''.
getDopplerScale
function love.audio.getDopplerScale()
-> scale: number
Gets the current global scale factor for velocity-based doppler effects.
@return scale — The current doppler scale factor.
getEffect
function love.audio.getEffect(name: string)
-> settings: table
Gets the settings associated with an effect.
@param name — The name of the effect.
@return settings — The settings associated with the effect.
getMaxSceneEffects
function love.audio.getMaxSceneEffects()
-> maximum: number
Gets the maximum number of active effects supported by the system.
@return maximum — The maximum number of active effects.
getMaxSourceEffects
function love.audio.getMaxSourceEffects()
-> maximum: number
Gets the maximum number of active Effects in a single Source object, that the system can support.
@return maximum — The maximum number of active Effects per Source.
getOrientation
function love.audio.getOrientation()
-> fx: number
2. fy: number
3. fz: number
4. ux: number
5. uy: number
6. uz: number
Returns the orientation of the listener.
@return fx — Forward vector of the listener orientation.
@return fy — Forward vector of the listener orientation.
@return fz — Forward vector of the listener orientation.
@return ux — Up vector of the listener orientation.
@return uy — Up vector of the listener orientation.
@return uz — Up vector of the listener orientation.
getPosition
function love.audio.getPosition()
-> x: number
2. y: number
3. z: number
Returns the position of the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources.
@return x — The X position of the listener.
@return y — The Y position of the listener.
@return z — The Z position of the listener.
getRecordingDevices
function love.audio.getRecordingDevices()
-> devices: table
Gets a list of RecordingDevices on the system.
The first device in the list is the user's default recording device. The list may be empty if there are no microphones connected to the system.
Audio recording is currently not supported on iOS.
@return devices — The list of connected recording devices.
getVelocity
function love.audio.getVelocity()
-> x: number
2. y: number
3. z: number
Returns the velocity of the listener.
@return x — The X velocity of the listener.
@return y — The Y velocity of the listener.
@return z — The Z velocity of the listener.
getVolume
function love.audio.getVolume()
-> volume: number
Returns the master volume.
@return volume — The current master volume
isEffectsSupported
function love.audio.isEffectsSupported()
-> supported: boolean
Gets whether audio effects are supported in the system.
@return supported — True if effects are supported, false otherwise.
newQueueableSource
function love.audio.newQueueableSource(samplerate: number, bitdepth: number, channels: number, buffercount?: number)
-> source: love.Source
Creates a new Source usable for real-time generated sound playback with Source:queue.
@param samplerate — Number of samples per second when playing.
@param bitdepth — Bits per sample (8 or 16).
@param channels — 1 for mono or 2 for stereo.
@param buffercount — The number of buffers that can be queued up at any given time with Source:queue. Cannot be greater than 64. A sensible default (~8) is chosen if no value is specified.
@return source — The new Source usable with Source:queue.
newSource
function love.audio.newSource(filename: string, type: "queue"|"static"|"stream")
-> source: love.Source
Creates a new Source from a filepath, File, Decoder or SoundData.
Sources created from SoundData are always static.
@param filename — The filepath to the audio file.
@param type — Streaming or static source.
@return source — A new Source that can play the specified audio.
--
-- Types of audio sources.
--
-- A good rule of thumb is to use stream for music files and static for all short sound effects. Basically, you want to avoid loading large files into memory at once.
--
--
-- [Open in Browser](https://love2d.org/wiki/SourceType)
--
type:
| "static" -- The whole audio is decoded.
| "stream" -- The audio is decoded in chunks when needed.
| "queue" -- The audio must be manually queued by the user.
pause
function love.audio.pause()
-> Sources: table
Pauses specific or all currently played Sources.
@return Sources — A table containing a list of Sources that were paused by this call.
play
function love.audio.play(source: love.Source)
Plays the specified Source.
@param source — The Source to play.
setDistanceModel
function love.audio.setDistanceModel(model: "exponent"|"exponentclamped"|"inverse"|"inverseclamped"|"linear"...(+2))
Sets the distance attenuation model.
@param model — The new distance model.
--
-- The different distance models.
--
-- Extended information can be found in the chapter "3.4. Attenuation By Distance" of the OpenAL 1.1 specification.
--
--
-- [Open in Browser](https://love2d.org/wiki/DistanceModel)
--
model:
| "none" -- Sources do not get attenuated.
| "inverse" -- Inverse distance attenuation.
| "inverseclamped" -- Inverse distance attenuation. Gain is clamped. In version 0.9.2 and older this is named '''inverse clamped'''.
| "linear" -- Linear attenuation.
| "linearclamped" -- Linear attenuation. Gain is clamped. In version 0.9.2 and older this is named '''linear clamped'''.
| "exponent" -- Exponential attenuation.
| "exponentclamped" -- Exponential attenuation. Gain is clamped. In version 0.9.2 and older this is named '''exponent clamped'''.
setDopplerScale
function love.audio.setDopplerScale(scale: number)
Sets a global scale factor for velocity-based doppler effects. The default scale value is 1.
@param scale — The new doppler scale factor. The scale must be greater than 0.
setEffect
function love.audio.setEffect(name: string, settings: { type: "chorus"|"compressor"|"distortion"|"echo"|"equalizer"...(+3), volume: number })
-> success: boolean
Defines an effect that can be applied to a Source.
Not all system supports audio effects. Use love.audio.isEffectsSupported to check.
@param name — The name of the effect.
@param settings — The settings to use for this effect, with the following fields:
@return success — Whether the effect was successfully created.
setMixWithSystem
function love.audio.setMixWithSystem(mix: boolean)
-> success: boolean
Sets whether the system should mix the audio with the system's audio.
@param mix — True to enable mixing, false to disable it.
@return success — True if the change succeeded, false otherwise.
setOrientation
function love.audio.setOrientation(fx: number, fy: number, fz: number, ux: number, uy: number, uz: number)
Sets the orientation of the listener.
@param fx — Forward vector of the listener orientation.
@param fy — Forward vector of the listener orientation.
@param fz — Forward vector of the listener orientation.
@param ux — Up vector of the listener orientation.
@param uy — Up vector of the listener orientation.
@param uz — Up vector of the listener orientation.
setPosition
function love.audio.setPosition(x: number, y: number, z: number)
Sets the position of the listener, which determines how sounds play.
@param x — The x position of the listener.
@param y — The y position of the listener.
@param z — The z position of the listener.
setVelocity
function love.audio.setVelocity(x: number, y: number, z: number)
Sets the velocity of the listener.
@param x — The X velocity of the listener.
@param y — The Y velocity of the listener.
@param z — The Z velocity of the listener.
setVolume
function love.audio.setVolume(volume: number)
Sets the master volume.
@param volume — 1.0 is max and 0.0 is off.
stop
function love.audio.stop()
Stops currently played sources.
love.audio.getActiveEffects
function love.audio.getActiveEffects()
-> effects: table
love.audio.getActiveSourceCount
function love.audio.getActiveSourceCount()
-> count: number
love.audio.getDistanceModel
function love.audio.getDistanceModel()
-> model: "exponent"|"exponentclamped"|"inverse"|"inverseclamped"|"linear"...(+2)
love.audio.getDopplerScale
function love.audio.getDopplerScale()
-> scale: number
love.audio.getEffect
function love.audio.getEffect(name: string)
-> settings: table
love.audio.getMaxSceneEffects
function love.audio.getMaxSceneEffects()
-> maximum: number
love.audio.getMaxSourceEffects
function love.audio.getMaxSourceEffects()
-> maximum: number
love.audio.getOrientation
function love.audio.getOrientation()
-> fx: number
2. fy: number
3. fz: number
4. ux: number
5. uy: number
6. uz: number
love.audio.getPosition
function love.audio.getPosition()
-> x: number
2. y: number
3. z: number
love.audio.getRecordingDevices
function love.audio.getRecordingDevices()
-> devices: table
love.audio.getVelocity
function love.audio.getVelocity()
-> x: number
2. y: number
3. z: number
love.audio.getVolume
function love.audio.getVolume()
-> volume: number
love.audio.isEffectsSupported
function love.audio.isEffectsSupported()
-> supported: boolean
love.audio.newQueueableSource
function love.audio.newQueueableSource(samplerate: number, bitdepth: number, channels: number, buffercount?: number)
-> source: love.Source
love.audio.newSource
function love.audio.newSource(filename: string, type: "queue"|"static"|"stream")
-> source: love.Source
love.audio.pause
function love.audio.pause()
-> Sources: table
love.audio.play
function love.audio.play(source: love.Source)
love.audio.setDistanceModel
function love.audio.setDistanceModel(model: "exponent"|"exponentclamped"|"inverse"|"inverseclamped"|"linear"...(+2))
love.audio.setDopplerScale
function love.audio.setDopplerScale(scale: number)
love.audio.setEffect
function love.audio.setEffect(name: string, settings: { type: "chorus"|"compressor"|"distortion"|"echo"|"equalizer"...(+3), volume: number })
-> success: boolean
love.audio.setMixWithSystem
function love.audio.setMixWithSystem(mix: boolean)
-> success: boolean
love.audio.setOrientation
function love.audio.setOrientation(fx: number, fy: number, fz: number, ux: number, uy: number, uz: number)
love.audio.setPosition
function love.audio.setPosition(x: number, y: number, z: number)
love.audio.setVelocity
function love.audio.setVelocity(x: number, y: number, z: number)
love.audio.setVolume
function love.audio.setVolume(volume: number)
love.audio.stop
function love.audio.stop()
love.conf
love.conf
function love.conf(t: any)
love.data
love.data
love.data
compress
function love.data.compress(container: "data"|"string", format: "deflate"|"gzip"|"lz4"|"zlib", rawstring: string, level?: number)
-> compressedData: string|love.CompressedData
Compresses a string or data using a specific compression algorithm.
@param container — What type to return the compressed data as.
@param format — The format to use when compressing the string.
@param rawstring — The raw (un-compressed) string to compress.
@param level — The level of compression to use, between 0 and 9. -1 indicates the default level. The meaning of this argument depends on the compression format being used.
@return compressedData — CompressedData/string which contains the compressed version of rawstring.
--
-- Return type of various data-returning functions.
--
--
-- [Open in Browser](https://love2d.org/wiki/ContainerType)
--
container:
| "data" -- Return type is ByteData.
| "string" -- Return type is string.
--
-- Compressed data formats.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompressedDataFormat)
--
format:
| "lz4" -- The LZ4 compression format. Compresses and decompresses very quickly, but the compression ratio is not the best. LZ4-HC is used when compression level 9 is specified. Some benchmarks are available here.
| "zlib" -- The zlib format is DEFLATE-compressed data with a small bit of header data. Compresses relatively slowly and decompresses moderately quickly, and has a decent compression ratio.
| "gzip" -- The gzip format is DEFLATE-compressed data with a slightly larger header than zlib. Since it uses DEFLATE it has the same compression characteristics as the zlib format.
| "deflate" -- Raw DEFLATE-compressed data (no header).
decode
function love.data.decode(container: "data"|"string", format: "base64"|"hex", sourceString: string)
-> decoded: string|love.ByteData
Decode Data or a string from any of the EncodeFormats to Data or string.
@param container — What type to return the decoded data as.
@param format — The format of the input data.
@param sourceString — The raw (encoded) data to decode.
@return decoded — ByteData/string which contains the decoded version of source.
--
-- Return type of various data-returning functions.
--
--
-- [Open in Browser](https://love2d.org/wiki/ContainerType)
--
container:
| "data" -- Return type is ByteData.
| "string" -- Return type is string.
--
-- Encoding format used to encode or decode data.
--
--
-- [Open in Browser](https://love2d.org/wiki/EncodeFormat)
--
format:
| "base64" -- Encode/decode data as base64 binary-to-text encoding.
| "hex" -- Encode/decode data as hexadecimal string.
decompress
function love.data.decompress(container: "data"|"string", compressedData: love.CompressedData)
-> decompressedData: string|love.Data
Decompresses a CompressedData or previously compressed string or Data object.
@param container — What type to return the decompressed data as.
@param compressedData — The compressed data to decompress.
@return decompressedData — Data/string containing the raw decompressed data.
--
-- Return type of various data-returning functions.
--
--
-- [Open in Browser](https://love2d.org/wiki/ContainerType)
--
container:
| "data" -- Return type is ByteData.
| "string" -- Return type is string.
encode
function love.data.encode(container: "data"|"string", format: "base64"|"hex", sourceString: string, linelength?: number)
-> encoded: string|love.ByteData
Encode Data or a string to a Data or string in one of the EncodeFormats.
@param container — What type to return the encoded data as.
@param format — The format of the output data.
@param sourceString — The raw data to encode.
@param linelength — The maximum line length of the output. Only supported for base64, ignored if 0.
@return encoded — ByteData/string which contains the encoded version of source.
--
-- Return type of various data-returning functions.
--
--
-- [Open in Browser](https://love2d.org/wiki/ContainerType)
--
container:
| "data" -- Return type is ByteData.
| "string" -- Return type is string.
--
-- Encoding format used to encode or decode data.
--
--
-- [Open in Browser](https://love2d.org/wiki/EncodeFormat)
--
format:
| "base64" -- Encode/decode data as base64 binary-to-text encoding.
| "hex" -- Encode/decode data as hexadecimal string.
getPackedSize
function love.data.getPackedSize(format: string)
-> size: number
Gets the size in bytes that a given format used with love.data.pack will use.
This function behaves the same as Lua 5.3's string.packsize.
@param format — A string determining how the values are packed. Follows the rules of Lua 5.3's string.pack format strings.
@return size — The size in bytes that the packed data will use.
hash
function love.data.hash(hashFunction: "md5"|"sha1"|"sha224"|"sha256"|"sha384"...(+1), string: string)
-> rawdigest: string
Compute the message digest of a string using a specified hash algorithm.
@param hashFunction — Hash algorithm to use.
@param string — String to hash.
@return rawdigest — Raw message digest string.
--
-- Hash algorithm of love.data.hash.
--
--
-- [Open in Browser](https://love2d.org/wiki/HashFunction)
--
hashFunction:
| "md5" -- MD5 hash algorithm (16 bytes).
| "sha1" -- SHA1 hash algorithm (20 bytes).
| "sha224" -- SHA2 hash algorithm with message digest size of 224 bits (28 bytes).
| "sha256" -- SHA2 hash algorithm with message digest size of 256 bits (32 bytes).
| "sha384" -- SHA2 hash algorithm with message digest size of 384 bits (48 bytes).
| "sha512" -- SHA2 hash algorithm with message digest size of 512 bits (64 bytes).
newByteData
function love.data.newByteData(datastring: string)
-> bytedata: love.ByteData
Creates a new Data object containing arbitrary bytes.
Data:getPointer along with LuaJIT's FFI can be used to manipulate the contents of the ByteData object after it has been created.
@param datastring — The byte string to copy.
@return bytedata — The new Data object.
newDataView
function love.data.newDataView(data: love.Data, offset: number, size: number)
-> view: love.Data
Creates a new Data referencing a subsection of an existing Data object.
@param data — The Data object to reference.
@param offset — The offset of the subsection to reference, in bytes.
@param size — The size in bytes of the subsection to reference.
@return view — The new Data view.
pack
function love.data.pack(container: "data"|"string", format: string, v1: boolean|string|number, ...boolean|string|number)
-> data: string|love.Data
Packs (serializes) simple Lua values.
This function behaves the same as Lua 5.3's string.pack.
@param container — What type to return the encoded data as.
@param format — A string determining how the values are packed. Follows the rules of Lua 5.3's string.pack format strings.
@param v1 — The first value (number, boolean, or string) to serialize.
@return data — Data/string which contains the serialized data.
--
-- Return type of various data-returning functions.
--
--
-- [Open in Browser](https://love2d.org/wiki/ContainerType)
--
container:
| "data" -- Return type is ByteData.
| "string" -- Return type is string.
unpack
function love.data.unpack(format: string, datastring: string, pos?: number)
-> v1: boolean|string|number
2. index: number
Unpacks (deserializes) a byte-string or Data into simple Lua values.
This function behaves the same as Lua 5.3's string.unpack.
@param format — A string determining how the values were packed. Follows the rules of Lua 5.3's string.pack format strings.
@param datastring — A string containing the packed (serialized) data.
@param pos — Where to start reading in the string. Negative values can be used to read relative from the end of the string.
@return v1 — The first value (number, boolean, or string) that was unpacked.
@return index — The index of the first unread byte in the data string.
love.data.compress
function love.data.compress(container: "data"|"string", format: "deflate"|"gzip"|"lz4"|"zlib", rawstring: string, level?: number)
-> compressedData: string|love.CompressedData
love.data.decode
function love.data.decode(container: "data"|"string", format: "base64"|"hex", sourceString: string)
-> decoded: string|love.ByteData
love.data.decompress
function love.data.decompress(container: "data"|"string", compressedData: love.CompressedData)
-> decompressedData: string|love.Data
love.data.encode
function love.data.encode(container: "data"|"string", format: "base64"|"hex", sourceString: string, linelength?: number)
-> encoded: string|love.ByteData
love.data.getPackedSize
function love.data.getPackedSize(format: string)
-> size: number
love.data.hash
function love.data.hash(hashFunction: "md5"|"sha1"|"sha224"|"sha256"|"sha384"...(+1), string: string)
-> rawdigest: string
love.data.newByteData
function love.data.newByteData(datastring: string)
-> bytedata: love.ByteData
love.data.newDataView
function love.data.newDataView(data: love.Data, offset: number, size: number)
-> view: love.Data
love.data.pack
function love.data.pack(container: "data"|"string", format: string, v1: boolean|string|number, ...boolean|string|number)
-> data: string|love.Data
love.data.unpack
function love.data.unpack(format: string, datastring: string, pos?: number)
-> v1: boolean|string|number
2. index: number
love.directorydropped
love.displayrotated
love.draw
love.errorhandler
love.event
clear
function love.event.clear()
Clears the event queue.
poll
function love.event.poll()
-> i: function
Returns an iterator for messages in the event queue.
@return i — Iterator function usable in a for loop.
pump
function love.event.pump()
Pump events into the event queue.
This is a low-level function, and is usually not called by the user, but by love.run.
Note that this does need to be called for any OS to think you're still running,
and if you want to handle OS-generated events at all (think callbacks).
push
function love.event.push(n: "directorydropped"|"f"|"filedropped"|"focus"|"gamepadaxis"...(+32), a?: any, b?: any, c?: any, d?: any, e?: any, f?: any, ...any)
Adds an event to the event queue.
From 0.10.0 onwards, you may pass an arbitrary amount of arguments with this function, though the default callbacks don't ever use more than six.
@param n — The name of the event.
@param a — First event argument.
@param b — Second event argument.
@param c — Third event argument.
@param d — Fourth event argument.
@param e — Fifth event argument.
@param f — Sixth event argument.
--
-- Arguments to love.event.push() and the like.
--
-- Since 0.8.0, event names are no longer abbreviated.
--
--
-- [Open in Browser](https://love2d.org/wiki/Event)
--
n:
| "focus" -- Window focus gained or lost
| "joystickpressed" -- Joystick pressed
| "joystickreleased" -- Joystick released
| "keypressed" -- Key pressed
| "keyreleased" -- Key released
| "mousepressed" -- Mouse pressed
| "mousereleased" -- Mouse released
| "quit" -- Quit
| "resize" -- Window size changed by the user
| "visible" -- Window is minimized or un-minimized by the user
| "mousefocus" -- Window mouse focus gained or lost
| "threaderror" -- A Lua error has occurred in a thread
| "joystickadded" -- Joystick connected
| "joystickremoved" -- Joystick disconnected
| "joystickaxis" -- Joystick axis motion
| "joystickhat" -- Joystick hat pressed
| "gamepadpressed" -- Joystick's virtual gamepad button pressed
| "gamepadreleased" -- Joystick's virtual gamepad button released
| "gamepadaxis" -- Joystick's virtual gamepad axis moved
| "textinput" -- User entered text
| "mousemoved" -- Mouse position changed
| "lowmemory" -- Running out of memory on mobile devices system
| "textedited" -- Candidate text for an IME changed
| "wheelmoved" -- Mouse wheel moved
| "touchpressed" -- Touch screen touched
| "touchreleased" -- Touch screen stop touching
| "touchmoved" -- Touch press moved inside touch screen
| "directorydropped" -- Directory is dragged and dropped onto the window
| "filedropped" -- File is dragged and dropped onto the window.
| "jp" -- Joystick pressed
| "jr" -- Joystick released
| "kp" -- Key pressed
| "kr" -- Key released
| "mp" -- Mouse pressed
| "mr" -- Mouse released
| "q" -- Quit
| "f" -- Window focus gained or lost
quit
function love.event.quit(exitstatus?: number)
Adds the quit event to the queue.
The quit event is a signal for the event handler to close LÖVE. It's possible to abort the exit process with the love.quit callback.
@param exitstatus — The program exit status to use when closing the application.
wait
function love.event.wait()
-> n: "directorydropped"|"f"|"filedropped"|"focus"|"gamepadaxis"...(+32)
2. a: any
3. b: any
4. c: any
5. d: any
6. e: any
7. f: any
Like love.event.poll(), but blocks until there is an event in the queue.
@return n — The name of event.
@return a — First event argument.
@return b — Second event argument.
@return c — Third event argument.
@return d — Fourth event argument.
@return e — Fifth event argument.
@return f — Sixth event argument.
--
-- Arguments to love.event.push() and the like.
--
-- Since 0.8.0, event names are no longer abbreviated.
--
--
-- [Open in Browser](https://love2d.org/wiki/Event)
--
n:
| "focus" -- Window focus gained or lost
| "joystickpressed" -- Joystick pressed
| "joystickreleased" -- Joystick released
| "keypressed" -- Key pressed
| "keyreleased" -- Key released
| "mousepressed" -- Mouse pressed
| "mousereleased" -- Mouse released
| "quit" -- Quit
| "resize" -- Window size changed by the user
| "visible" -- Window is minimized or un-minimized by the user
| "mousefocus" -- Window mouse focus gained or lost
| "threaderror" -- A Lua error has occurred in a thread
| "joystickadded" -- Joystick connected
| "joystickremoved" -- Joystick disconnected
| "joystickaxis" -- Joystick axis motion
| "joystickhat" -- Joystick hat pressed
| "gamepadpressed" -- Joystick's virtual gamepad button pressed
| "gamepadreleased" -- Joystick's virtual gamepad button released
| "gamepadaxis" -- Joystick's virtual gamepad axis moved
| "textinput" -- User entered text
| "mousemoved" -- Mouse position changed
| "lowmemory" -- Running out of memory on mobile devices system
| "textedited" -- Candidate text for an IME changed
| "wheelmoved" -- Mouse wheel moved
| "touchpressed" -- Touch screen touched
| "touchreleased" -- Touch screen stop touching
| "touchmoved" -- Touch press moved inside touch screen
| "directorydropped" -- Directory is dragged and dropped onto the window
| "filedropped" -- File is dragged and dropped onto the window.
| "jp" -- Joystick pressed
| "jr" -- Joystick released
| "kp" -- Key pressed
| "kr" -- Key released
| "mp" -- Mouse pressed
| "mr" -- Mouse released
| "q" -- Quit
| "f" -- Window focus gained or lost
love.event
love.event
love.event.clear
function love.event.clear()
love.event.poll
function love.event.poll()
-> i: function
love.event.pump
function love.event.pump()
love.event.push
function love.event.push(n: "directorydropped"|"f"|"filedropped"|"focus"|"gamepadaxis"...(+32), a?: any, b?: any, c?: any, d?: any, e?: any, f?: any, ...any)
love.event.quit
function love.event.quit(exitstatus?: number)
love.event.wait
function love.event.wait()
-> n: "directorydropped"|"f"|"filedropped"|"focus"|"gamepadaxis"...(+32)
2. a: any
3. b: any
4. c: any
5. d: any
6. e: any
7. f: any
love.filedropped
love.filesystem
append
function love.filesystem.append(name: string, data: string, size?: number)
-> success: boolean
2. errormsg: string
Append data to an existing file.
@param name — The name (and path) of the file.
@param data — The string data to append to the file.
@param size — How many bytes to write.
@return success — True if the operation was successful, or nil if there was an error.
@return errormsg — The error message on failure.
areSymlinksEnabled
function love.filesystem.areSymlinksEnabled()
-> enable: boolean
Gets whether love.filesystem follows symbolic links.
@return enable — Whether love.filesystem follows symbolic links.
createDirectory
function love.filesystem.createDirectory(name: string)
-> success: boolean
Recursively creates a directory.
When called with 'a/b' it creates both 'a' and 'a/b', if they don't exist already.
@param name — The directory to create.
@return success — True if the directory was created, false if not.
getAppdataDirectory
function love.filesystem.getAppdataDirectory()
-> path: string
Returns the application data directory (could be the same as getUserDirectory)
@return path — The path of the application data directory
getCRequirePath
function love.filesystem.getCRequirePath()
-> paths: string
Gets the filesystem paths that will be searched for c libraries when require is called.
The paths string returned by this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.) Additionally, any occurrence of a double question mark ('??') will be replaced by the name passed to require and the default library extension for the platform.
The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount.
@return paths — The paths that the ''require'' function will check for c libraries in love's filesystem.
getDirectoryItems
function love.filesystem.getDirectoryItems(dir: string)
-> files: table
Returns a table with the names of files and subdirectories in the specified path. The table is not sorted in any way; the order is undefined.
If the path passed to the function exists in the game and the save directory, it will list the files and directories from both places.
@param dir — The directory.
@return files — A sequence with the names of all files and subdirectories as strings.
getIdentity
function love.filesystem.getIdentity()
-> name: string
Gets the write directory name for your game.
Note that this only returns the name of the folder to store your files in, not the full path.
@return name — The identity that is used as write directory.
getInfo
function love.filesystem.getInfo(path: string, filtertype?: "directory"|"file"|"other"|"symlink")
-> info: { type: "directory"|"file"|"other"|"symlink", size: number, modtime: number }
Gets information about the specified file or directory.
@param path — The file or directory path to check.
@param filtertype — If supplied, this parameter causes getInfo to only return the info table if the item at the given path matches the specified file type.
@return info — A table containing information about the specified path, or nil if nothing exists at the path. The table contains the following fields:
--
-- The type of a file.
--
--
-- [Open in Browser](https://love2d.org/wiki/FileType)
--
filtertype:
| "file" -- Regular file.
| "directory" -- Directory.
| "symlink" -- Symbolic link.
| "other" -- Something completely different like a device.
getRealDirectory
function love.filesystem.getRealDirectory(filepath: string)
-> realdir: string
Gets the platform-specific absolute path of the directory containing a filepath.
This can be used to determine whether a file is inside the save directory or the game's source .love.
@param filepath — The filepath to get the directory of.
@return realdir — The platform-specific full path of the directory containing the filepath.
getRequirePath
function love.filesystem.getRequirePath()
-> paths: string
Gets the filesystem paths that will be searched when require is called.
The paths string returned by this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.)
The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount.
@return paths — The paths that the ''require'' function will check in love's filesystem.
getSaveDirectory
function love.filesystem.getSaveDirectory()
-> dir: string
Gets the full path to the designated save directory.
This can be useful if you want to use the standard io library (or something else) to
read or write in the save directory.
@return dir — The absolute path to the save directory.
getSource
function love.filesystem.getSource()
-> path: string
Returns the full path to the the .love file or directory. If the game is fused to the LÖVE executable, then the executable is returned.
@return path — The full platform-dependent path of the .love file or directory.
getSourceBaseDirectory
function love.filesystem.getSourceBaseDirectory()
-> path: string
Returns the full path to the directory containing the .love file. If the game is fused to the LÖVE executable, then the directory containing the executable is returned.
If love.filesystem.isFused is true, the path returned by this function can be passed to love.filesystem.mount, which will make the directory containing the main game (e.g. C:\Program Files\coolgame) readable by love.filesystem.
@return path — The full platform-dependent path of the directory containing the .love file.
getUserDirectory
function love.filesystem.getUserDirectory()
-> path: string
Returns the path of the user's directory
@return path — The path of the user's directory
getWorkingDirectory
function love.filesystem.getWorkingDirectory()
-> cwd: string
Gets the current working directory.
@return cwd — The current working directory.
init
function love.filesystem.init(appname: string)
Initializes love.filesystem, will be called internally, so should not be used explicitly.
@param appname — The name of the application binary, typically love.
isFused
function love.filesystem.isFused()
-> fused: boolean
Gets whether the game is in fused mode or not.
If a game is in fused mode, its save directory will be directly in the Appdata directory instead of Appdata/LOVE/. The game will also be able to load C Lua dynamic libraries which are located in the save directory.
A game is in fused mode if the source .love has been fused to the executable (see Game Distribution), or if '--fused' has been given as a command-line argument when starting the game.
@return fused — True if the game is in fused mode, false otherwise.
lines
function love.filesystem.lines(name: string)
-> iterator: function
Iterate over the lines in a file.
@param name — The name (and path) of the file
@return iterator — A function that iterates over all the lines in the file
load
function love.filesystem.load(name: string)
-> chunk: function
2. errormsg: string
Loads a Lua file (but does not run it).
@param name — The name (and path) of the file.
@return chunk — The loaded chunk.
@return errormsg — The error message if file could not be opened.
mount
function love.filesystem.mount(archive: string, mountpoint: string, appendToPath?: boolean)
-> success: boolean
Mounts a zip file or folder in the game's save directory for reading.
It is also possible to mount love.filesystem.getSourceBaseDirectory if the game is in fused mode.
@param archive — The folder or zip file in the game's save directory to mount.
@param mountpoint — The new path the archive will be mounted to.
@param appendToPath — Whether the archive will be searched when reading a filepath before or after already-mounted archives. This includes the game's source and save directories.
@return success — True if the archive was successfully mounted, false otherwise.
newFile
function love.filesystem.newFile(filename: string)
-> file: love.File
Creates a new File object.
It needs to be opened before it can be accessed.
@param filename — The filename of the file.
@return file — The new File object.
newFileData
function love.filesystem.newFileData(contents: string, name: string)
-> data: love.FileData
Creates a new FileData object from a file on disk, or from a string in memory.
@param contents — The contents of the file in memory represented as a string.
@param name — The name of the file. The extension may be parsed and used by LÖVE when passing the FileData object into love.audio.newSource.
@return data — The new FileData.
read
function love.filesystem.read(name: string, size?: number)
-> contents: string
2. size: number
3. contents: nil
4. error: string
Read the contents of a file.
@param name — The name (and path) of the file.
@param size — How many bytes to read.
@return contents — The file contents.
@return size — How many bytes have been read.
@return contents — returns nil as content.
@return error — returns an error message.
remove
function love.filesystem.remove(name: string)
-> success: boolean
Removes a file or empty directory.
@param name — The file or directory to remove.
@return success — True if the file/directory was removed, false otherwise.
setCRequirePath
function love.filesystem.setCRequirePath(paths: string)
Sets the filesystem paths that will be searched for c libraries when require is called.
The paths string returned by this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.) Additionally, any occurrence of a double question mark ('??') will be replaced by the name passed to require and the default library extension for the platform.
The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount.
@param paths — The paths that the ''require'' function will check in love's filesystem.
setIdentity
function love.filesystem.setIdentity(name: string)
Sets the write directory for your game.
Note that you can only set the name of the folder to store your files in, not the location.
@param name — The new identity that will be used as write directory.
setRequirePath
function love.filesystem.setRequirePath(paths: string)
Sets the filesystem paths that will be searched when require is called.
The paths string given to this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.)
The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount.
@param paths — The paths that the ''require'' function will check in love's filesystem.
setSource
function love.filesystem.setSource(path: string)
Sets the source of the game, where the code is present. This function can only be called once, and is normally automatically done by LÖVE.
@param path — Absolute path to the game's source folder.
setSymlinksEnabled
function love.filesystem.setSymlinksEnabled(enable: boolean)
Sets whether love.filesystem follows symbolic links. It is enabled by default in version 0.10.0 and newer, and disabled by default in 0.9.2.
@param enable — Whether love.filesystem should follow symbolic links.
unmount
function love.filesystem.unmount(archive: string)
-> success: boolean
Unmounts a zip file or folder previously mounted for reading with love.filesystem.mount.
@param archive — The folder or zip file in the game's save directory which is currently mounted.
@return success — True if the archive was successfully unmounted, false otherwise.
write
function love.filesystem.write(name: string, data: string, size?: number)
-> success: boolean
2. message: string
Write data to a file in the save directory. If the file existed already, it will be completely replaced by the new contents.
@param name — The name (and path) of the file.
@param data — The string data to write to the file.
@param size — How many bytes to write.
@return success — If the operation was successful.
@return message — Error message if operation was unsuccessful.
love.filesystem
love.filesystem
love.filesystem.append
function love.filesystem.append(name: string, data: string, size?: number)
-> success: boolean
2. errormsg: string
love.filesystem.areSymlinksEnabled
function love.filesystem.areSymlinksEnabled()
-> enable: boolean
love.filesystem.createDirectory
function love.filesystem.createDirectory(name: string)
-> success: boolean
love.filesystem.getAppdataDirectory
function love.filesystem.getAppdataDirectory()
-> path: string
love.filesystem.getCRequirePath
function love.filesystem.getCRequirePath()
-> paths: string
love.filesystem.getDirectoryItems
function love.filesystem.getDirectoryItems(dir: string)
-> files: table
love.filesystem.getIdentity
function love.filesystem.getIdentity()
-> name: string
love.filesystem.getInfo
function love.filesystem.getInfo(path: string, filtertype?: "directory"|"file"|"other"|"symlink")
-> info: { type: "directory"|"file"|"other"|"symlink", size: number, modtime: number }
love.filesystem.getRealDirectory
function love.filesystem.getRealDirectory(filepath: string)
-> realdir: string
love.filesystem.getRequirePath
function love.filesystem.getRequirePath()
-> paths: string
love.filesystem.getSaveDirectory
function love.filesystem.getSaveDirectory()
-> dir: string
love.filesystem.getSource
function love.filesystem.getSource()
-> path: string
love.filesystem.getSourceBaseDirectory
function love.filesystem.getSourceBaseDirectory()
-> path: string
love.filesystem.getUserDirectory
function love.filesystem.getUserDirectory()
-> path: string
love.filesystem.getWorkingDirectory
function love.filesystem.getWorkingDirectory()
-> cwd: string
love.filesystem.init
function love.filesystem.init(appname: string)
love.filesystem.isFused
function love.filesystem.isFused()
-> fused: boolean
love.filesystem.lines
function love.filesystem.lines(name: string)
-> iterator: function
love.filesystem.load
function love.filesystem.load(name: string)
-> chunk: function
2. errormsg: string
love.filesystem.mount
function love.filesystem.mount(archive: string, mountpoint: string, appendToPath?: boolean)
-> success: boolean
love.filesystem.newFile
function love.filesystem.newFile(filename: string)
-> file: love.File
love.filesystem.newFileData
function love.filesystem.newFileData(contents: string, name: string)
-> data: love.FileData
love.filesystem.read
function love.filesystem.read(name: string, size?: number)
-> contents: string
2. size: number
3. contents: nil
4. error: string
love.filesystem.remove
function love.filesystem.remove(name: string)
-> success: boolean
love.filesystem.setCRequirePath
function love.filesystem.setCRequirePath(paths: string)
love.filesystem.setIdentity
function love.filesystem.setIdentity(name: string)
love.filesystem.setRequirePath
function love.filesystem.setRequirePath(paths: string)
love.filesystem.setSource
function love.filesystem.setSource(path: string)
love.filesystem.setSymlinksEnabled
function love.filesystem.setSymlinksEnabled(enable: boolean)
love.filesystem.unmount
function love.filesystem.unmount(archive: string)
-> success: boolean
love.filesystem.write
function love.filesystem.write(name: string, data: string, size?: number)
-> success: boolean
2. message: string
love.focus
love.font
love.font
love.font
newBMFontRasterizer
function love.font.newBMFontRasterizer(imageData: love.ImageData, glyphs: string, dpiscale?: number)
-> rasterizer: love.Rasterizer
Creates a new BMFont Rasterizer.
@param imageData — The image data containing the drawable pictures of font glyphs.
@param glyphs — The sequence of glyphs in the ImageData.
@param dpiscale — DPI scale.
@return rasterizer — The rasterizer.
newGlyphData
function love.font.newGlyphData(rasterizer: love.Rasterizer, glyph: number)
Creates a new GlyphData.
@param rasterizer — The Rasterizer containing the font.
@param glyph — The character code of the glyph.
newImageRasterizer
function love.font.newImageRasterizer(imageData: love.ImageData, glyphs: string, extraSpacing?: number, dpiscale?: number)
-> rasterizer: love.Rasterizer
Creates a new Image Rasterizer.
@param imageData — Font image data.
@param glyphs — String containing font glyphs.
@param extraSpacing — Font extra spacing.
@param dpiscale — Font DPI scale.
@return rasterizer — The rasterizer.
newRasterizer
function love.font.newRasterizer(filename: string)
-> rasterizer: love.Rasterizer
Creates a new Rasterizer.
@param filename — The font file.
@return rasterizer — The rasterizer.
newTrueTypeRasterizer
function love.font.newTrueTypeRasterizer(size?: number, hinting?: "light"|"mono"|"none"|"normal", dpiscale?: number)
-> rasterizer: love.Rasterizer
Creates a new TrueType Rasterizer.
@param size — The font size.
@param hinting — True Type hinting mode.
@param dpiscale — The font DPI scale.
@return rasterizer — The rasterizer.
--
-- True Type hinting mode.
--
--
-- [Open in Browser](https://love2d.org/wiki/HintingMode)
--
hinting:
| "normal" -- Default hinting. Should be preferred for typical antialiased fonts.
| "light" -- Results in fuzzier text but can sometimes preserve the original glyph shapes of the text better than normal hinting.
| "mono" -- Results in aliased / unsmoothed text with either full opacity or completely transparent pixels. Should be used when antialiasing is not desired for the font.
| "none" -- Disables hinting for the font. Results in fuzzier text.
love.font.newBMFontRasterizer
function love.font.newBMFontRasterizer(imageData: love.ImageData, glyphs: string, dpiscale?: number)
-> rasterizer: love.Rasterizer
love.font.newGlyphData
function love.font.newGlyphData(rasterizer: love.Rasterizer, glyph: number)
love.font.newImageRasterizer
function love.font.newImageRasterizer(imageData: love.ImageData, glyphs: string, extraSpacing?: number, dpiscale?: number)
-> rasterizer: love.Rasterizer
love.font.newRasterizer
function love.font.newRasterizer(filename: string)
-> rasterizer: love.Rasterizer
love.font.newTrueTypeRasterizer
function love.font.newTrueTypeRasterizer(size?: number, hinting?: "light"|"mono"|"none"|"normal", dpiscale?: number)
-> rasterizer: love.Rasterizer
love.gamepadaxis
love.gamepadpressed
love.gamepadreleased
love.getVersion
function love.getVersion()
-> major: number
2. minor: number
3. revision: number
4. codename: string
love.graphics
applyTransform
function love.graphics.applyTransform(transform: love.Transform)
Applies the given Transform object to the current coordinate transformation.
This effectively multiplies the existing coordinate transformation's matrix with the Transform object's internal matrix to produce the new coordinate transformation.
@param transform — The Transform object to apply to the current graphics coordinate transform.
arc
function love.graphics.arc(drawmode: "fill"|"line", x: number, y: number, radius: number, angle1: number, angle2: number, segments?: number)
Draws a filled or unfilled arc at position (x, y). The arc is drawn from angle1 to angle2 in radians. The segments parameter determines how many segments are used to draw the arc. The more segments, the smoother the edge.
@param drawmode — How to draw the arc.
@param x — The position of the center along x-axis.
@param y — The position of the center along y-axis.
@param radius — Radius of the arc.
@param angle1 — The angle at which the arc begins.
@param angle2 — The angle at which the arc terminates.
@param segments — The number of segments used for drawing the arc.
--
-- Controls whether shapes are drawn as an outline, or filled.
--
--
-- [Open in Browser](https://love2d.org/wiki/DrawMode)
--
drawmode:
| "fill" -- Draw filled shape.
| "line" -- Draw outlined shape.
captureScreenshot
function love.graphics.captureScreenshot(filename: string)
Creates a screenshot once the current frame is done (after love.draw has finished).
Since this function enqueues a screenshot capture rather than executing it immediately, it can be called from an input callback or love.update and it will still capture all of what's drawn to the screen in that frame.
@param filename — The filename to save the screenshot to. The encoded image type is determined based on the extension of the filename, and must be one of the ImageFormats.
circle
function love.graphics.circle(mode: "fill"|"line", x: number, y: number, radius: number)
Draws a circle.
@param mode — How to draw the circle.
@param x — The position of the center along x-axis.
@param y — The position of the center along y-axis.
@param radius — The radius of the circle.
--
-- Controls whether shapes are drawn as an outline, or filled.
--
--
-- [Open in Browser](https://love2d.org/wiki/DrawMode)
--
mode:
| "fill" -- Draw filled shape.
| "line" -- Draw outlined shape.
clear
function love.graphics.clear()
Clears the screen or active Canvas to the specified color.
This function is called automatically before love.draw in the default love.run function. See the example in love.run for a typical use of this function.
Note that the scissor area bounds the cleared region.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
In versions prior to background color instead.
discard
function love.graphics.discard(discardcolor?: boolean, discardstencil?: boolean)
Discards (trashes) the contents of the screen or active Canvas. This is a performance optimization function with niche use cases.
If the active Canvas has just been changed and the 'replace' BlendMode is about to be used to draw something which covers the entire screen, calling love.graphics.discard rather than calling love.graphics.clear or doing nothing may improve performance on mobile devices.
On some desktop systems this function may do nothing.
@param discardcolor — Whether to discard the texture(s) of the active Canvas(es) (the contents of the screen if no Canvas is active.)
@param discardstencil — Whether to discard the contents of the stencil buffer of the screen / active Canvas.
draw
function love.graphics.draw(drawable: love.Drawable, x?: number, y?: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
Draws a Drawable object (an Image, Canvas, SpriteBatch, ParticleSystem, Mesh, Text object, or Video) on the screen with optional rotation, scaling and shearing.
Objects are drawn relative to their local coordinate system. The origin is by default located at the top left corner of Image and Canvas. All scaling, shearing, and rotation arguments transform the object relative to that point. Also, the position of the origin can be specified on the screen coordinate system.
It's possible to rotate an object about its center by offsetting the origin to the center. Angles must be given in radians for rotation. One can also use a negative scaling factor to flip about its centerline.
Note that the offsets are applied before rotation, scaling, or shearing; scaling and shearing are applied before rotation.
The right and bottom edges of the object are shifted at an angle defined by the shearing factors.
When using the default shader anything drawn with this function will be tinted according to the currently selected color.
Set it to pure white to preserve the object's original colors.
@param drawable — A drawable object.
@param x — The position to draw the object (x-axis).
@param y — The position to draw the object (y-axis).
@param r — Orientation (radians).
@param sx — Scale factor (x-axis).
@param sy — Scale factor (y-axis).
@param ox — Origin offset (x-axis).
@param oy — Origin offset (y-axis).
@param kx — Shearing factor (x-axis).
@param ky — Shearing factor (y-axis).
drawInstanced
function love.graphics.drawInstanced(mesh: love.Mesh, instancecount: number, x?: number, y?: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
Draws many instances of a Mesh with a single draw call, using hardware geometry instancing.
Each instance can have unique properties (positions, colors, etc.) but will not by default unless a custom per-instance vertex attributes or the love_InstanceID GLSL 3 vertex shader variable is used, otherwise they will all render at the same position on top of each other.
Instancing is not supported by some older GPUs that are only capable of using OpenGL ES 2 or OpenGL 2. Use love.graphics.getSupported to check.
@param mesh — The mesh to render.
@param instancecount — The number of instances to render.
@param x — The position to draw the instances (x-axis).
@param y — The position to draw the instances (y-axis).
@param r — Orientation (radians).
@param sx — Scale factor (x-axis).
@param sy — Scale factor (y-axis).
@param ox — Origin offset (x-axis).
@param oy — Origin offset (y-axis).
@param kx — Shearing factor (x-axis).
@param ky — Shearing factor (y-axis).
drawLayer
function love.graphics.drawLayer(texture: love.Texture, layerindex: number, x?: number, y?: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
Draws a layer of an Array Texture.
@param texture — The Array Texture to draw.
@param layerindex — The index of the layer to use when drawing.
@param x — The position to draw the texture (x-axis).
@param y — The position to draw the texture (y-axis).
@param r — Orientation (radians).
@param sx — Scale factor (x-axis).
@param sy — Scale factor (y-axis).
@param ox — Origin offset (x-axis).
@param oy — Origin offset (y-axis).
@param kx — Shearing factor (x-axis).
@param ky — Shearing factor (y-axis).
ellipse
function love.graphics.ellipse(mode: "fill"|"line", x: number, y: number, radiusx: number, radiusy: number)
Draws an ellipse.
@param mode — How to draw the ellipse.
@param x — The position of the center along x-axis.
@param y — The position of the center along y-axis.
@param radiusx — The radius of the ellipse along the x-axis (half the ellipse's width).
@param radiusy — The radius of the ellipse along the y-axis (half the ellipse's height).
--
-- Controls whether shapes are drawn as an outline, or filled.
--
--
-- [Open in Browser](https://love2d.org/wiki/DrawMode)
--
mode:
| "fill" -- Draw filled shape.
| "line" -- Draw outlined shape.
flushBatch
function love.graphics.flushBatch()
Immediately renders any pending automatically batched draws.
LÖVE will call this function internally as needed when most state is changed, so it is not necessary to manually call it.
The current batch will be automatically flushed by love.graphics state changes (except for the transform stack and the current color), as well as Shader:send and methods on Textures which change their state. Using a different Image in consecutive love.graphics.draw calls will also flush the current batch.
SpriteBatches, ParticleSystems, Meshes, and Text objects do their own batching and do not affect automatic batching of other draws, aside from flushing the current batch when they're drawn.
getBackgroundColor
function love.graphics.getBackgroundColor()
-> r: number
2. g: number
3. b: number
4. a: number
Gets the current background color.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@return r — The red component (0-1).
@return g — The green component (0-1).
@return b — The blue component (0-1).
@return a — The alpha component (0-1).
getBlendMode
function love.graphics.getBlendMode()
-> mode: "add"|"additive"|"alpha"|"darken"|"lighten"...(+7)
2. alphamode: "alphamultiply"|"premultiplied"
Gets the blending mode.
@return mode — The current blend mode.
@return alphamode — The current blend alpha mode – it determines how the alpha of drawn objects affects blending.
--
-- Different ways to do color blending. See BlendAlphaMode and the BlendMode Formulas for additional notes.
--
--
-- [Open in Browser](https://love2d.org/wiki/BlendMode)
--
mode:
| "alpha" -- Alpha blending (normal). The alpha of what's drawn determines its opacity.
| "replace" -- The colors of what's drawn completely replace what was on the screen, with no additional blending. The BlendAlphaMode specified in love.graphics.setBlendMode still affects what happens.
| "screen" -- 'Screen' blending.
| "add" -- The pixel colors of what's drawn are added to the pixel colors already on the screen. The alpha of the screen is not modified.
| "subtract" -- The pixel colors of what's drawn are subtracted from the pixel colors already on the screen. The alpha of the screen is not modified.
| "multiply" -- The pixel colors of what's drawn are multiplied with the pixel colors already on the screen (darkening them). The alpha of drawn objects is multiplied with the alpha of the screen rather than determining how much the colors on the screen are affected, even when the "alphamultiply" BlendAlphaMode is used.
| "lighten" -- The pixel colors of what's drawn are compared to the existing pixel colors, and the larger of the two values for each color component is used. Only works when the "premultiplied" BlendAlphaMode is used in love.graphics.setBlendMode.
| "darken" -- The pixel colors of what's drawn are compared to the existing pixel colors, and the smaller of the two values for each color component is used. Only works when the "premultiplied" BlendAlphaMode is used in love.graphics.setBlendMode.
| "additive" -- Additive blend mode.
| "subtractive" -- Subtractive blend mode.
| "multiplicative" -- Multiply blend mode.
| "premultiplied" -- Premultiplied alpha blend mode.
--
-- Different ways alpha affects color blending. See BlendMode and the BlendMode Formulas for additional notes.
--
--
-- [Open in Browser](https://love2d.org/wiki/BlendAlphaMode)
--
alphamode:
| "alphamultiply" -- The RGB values of what's drawn are multiplied by the alpha values of those colors during blending. This is the default alpha mode.
| "premultiplied" -- The RGB values of what's drawn are '''not''' multiplied by the alpha values of those colors during blending. For most blend modes to work correctly with this alpha mode, the colors of a drawn object need to have had their RGB values multiplied by their alpha values at some point previously ("premultiplied alpha").
getCanvas
function love.graphics.getCanvas()
-> canvas: love.Canvas
Gets the current target Canvas.
@return canvas — The Canvas set by setCanvas. Returns nil if drawing to the real screen.
getCanvasFormats
function love.graphics.getCanvasFormats()
-> formats: table
Gets the available Canvas formats, and whether each is supported.
@return formats — A table containing CanvasFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats.
getColor
function love.graphics.getColor()
-> r: number
2. g: number
3. b: number
4. a: number
Gets the current color.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@return r — The red component (0-1).
@return g — The green component (0-1).
@return b — The blue component (0-1).
@return a — The alpha component (0-1).
getColorMask
function love.graphics.getColorMask()
-> r: boolean
2. g: boolean
3. b: boolean
4. a: boolean
Gets the active color components used when drawing. Normally all 4 components are active unless love.graphics.setColorMask has been used.
The color mask determines whether individual components of the colors of drawn objects will affect the color of the screen. They affect love.graphics.clear and Canvas:clear as well.
@return r — Whether the red color component is active when rendering.
@return g — Whether the green color component is active when rendering.
@return b — Whether the blue color component is active when rendering.
@return a — Whether the alpha color component is active when rendering.
getDPIScale
function love.graphics.getDPIScale()
-> scale: number
Gets the DPI scale factor of the window.
The DPI scale factor represents relative pixel density. The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.graphics.getDPIScale() would return 2 in that case.
The love.window.fromPixels and love.window.toPixels functions can also be used to convert between units.
The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled.
@return scale — The pixel scale factor associated with the window.
getDefaultFilter
function love.graphics.getDefaultFilter()
-> min: "linear"|"nearest"
2. mag: "linear"|"nearest"
3. anisotropy: number
Returns the default scaling filters used with Images, Canvases, and Fonts.
@return min — Filter mode used when scaling the image down.
@return mag — Filter mode used when scaling the image up.
@return anisotropy — Maximum amount of Anisotropic Filtering used.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
getDepthMode
function love.graphics.getDepthMode()
-> comparemode: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3)
2. write: boolean
Gets the current depth test mode and whether writing to the depth buffer is enabled.
This is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images.
@return comparemode — Depth comparison mode used for depth testing.
@return write — Whether to write update / write values to the depth buffer when rendering.
--
-- Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompareMode)
--
comparemode:
| "equal" -- * stencil tests: the stencil value of the pixel must be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.
| "notequal" -- * stencil tests: the stencil value of the pixel must not be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel.
| "less" -- * stencil tests: the stencil value of the pixel must be less than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.
| "lequal" -- * stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.
| "gequal" -- * stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.
| "greater" -- * stencil tests: the stencil value of the pixel must be greater than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.
| "never" -- Objects will never be drawn.
| "always" -- Objects will always be drawn. Effectively disables the depth or stencil test.
getDimensions
function love.graphics.getDimensions()
-> width: number
2. height: number
Gets the width and height in pixels of the window.
@return width — The width of the window.
@return height — The height of the window.
getFont
function love.graphics.getFont()
-> font: love.Font
Gets the current Font object.
@return font — The current Font. Automatically creates and sets the default font, if none is set yet.
getFrontFaceWinding
function love.graphics.getFrontFaceWinding()
-> winding: "ccw"|"cw"
Gets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing.
This is designed for use in combination with Mesh face culling. Other love.graphics shapes, lines, and sprites are not guaranteed to have a specific winding order to their internal vertices.
@return winding — The winding mode being used. The default winding is counterclockwise ('ccw').
--
-- How Mesh geometry vertices are ordered.
--
--
-- [Open in Browser](https://love2d.org/wiki/VertexWinding)
--
winding:
| "cw" -- Clockwise.
| "ccw" -- Counter-clockwise.
getHeight
function love.graphics.getHeight()
-> height: number
Gets the height in pixels of the window.
@return height — The height of the window.
getImageFormats
function love.graphics.getImageFormats()
-> formats: table
Gets the raw and compressed pixel formats usable for Images, and whether each is supported.
@return formats — A table containing PixelFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats.
getLineJoin
function love.graphics.getLineJoin()
-> join: "bevel"|"miter"|"none"
Gets the line join style.
@return join — The LineJoin style.
--
-- Line join style.
--
--
-- [Open in Browser](https://love2d.org/wiki/LineJoin)
--
join:
| "miter" -- The ends of the line segments beveled in an angle so that they join seamlessly.
| "none" -- No cap applied to the ends of the line segments.
| "bevel" -- Flattens the point where line segments join together.
getLineStyle
function love.graphics.getLineStyle()
-> style: "rough"|"smooth"
Gets the line style.
@return style — The current line style.
--
-- The styles in which lines are drawn.
--
--
-- [Open in Browser](https://love2d.org/wiki/LineStyle)
--
style:
| "rough" -- Draw rough lines.
| "smooth" -- Draw smooth lines.
getLineWidth
function love.graphics.getLineWidth()
-> width: number
Gets the current line width.
@return width — The current line width.
getMeshCullMode
function love.graphics.getMeshCullMode()
-> mode: "back"|"front"|"none"
Gets whether back-facing triangles in a Mesh are culled.
Mesh face culling is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer.
@return mode — The Mesh face culling mode in use (whether to render everything, cull back-facing triangles, or cull front-facing triangles).
--
-- How Mesh geometry is culled when rendering.
--
--
-- [Open in Browser](https://love2d.org/wiki/CullMode)
--
mode:
| "back" -- Back-facing triangles in Meshes are culled (not rendered). The vertex order of a triangle determines whether it is back- or front-facing.
| "front" -- Front-facing triangles in Meshes are culled.
| "none" -- Both back- and front-facing triangles in Meshes are rendered.
getPixelDimensions
function love.graphics.getPixelDimensions()
-> pixelwidth: number
2. pixelheight: number
Gets the width and height in pixels of the window.
love.graphics.getDimensions gets the dimensions of the window in units scaled by the screen's DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing to the screen and using the graphics coordinate system (calculating the center of the screen, for example), and getPixelDimensions only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example).
@return pixelwidth — The width of the window in pixels.
@return pixelheight — The height of the window in pixels.
getPixelHeight
function love.graphics.getPixelHeight()
-> pixelheight: number
Gets the height in pixels of the window.
The graphics coordinate system and DPI scale factor, rather than raw pixels. Use getHeight for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelHeight only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example).
@return pixelheight — The height of the window in pixels.
getPixelWidth
function love.graphics.getPixelWidth()
-> pixelwidth: number
Gets the width in pixels of the window.
The graphics coordinate system and DPI scale factor, rather than raw pixels. Use getWidth for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelWidth only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example).
@return pixelwidth — The width of the window in pixels.
getPointSize
function love.graphics.getPointSize()
-> size: number
Gets the point size.
@return size — The current point size.
getRendererInfo
function love.graphics.getRendererInfo()
-> name: string
2. version: string
3. vendor: string
4. device: string
Gets information about the system's video card and drivers.
@return name — The name of the renderer, e.g. 'OpenGL' or 'OpenGL ES'.
@return version — The version of the renderer with some extra driver-dependent version info, e.g. '2.1 INTEL-8.10.44'.
@return vendor — The name of the graphics card vendor, e.g. 'Intel Inc'.
@return device — The name of the graphics card, e.g. 'Intel HD Graphics 3000 OpenGL Engine'.
getScissor
function love.graphics.getScissor()
-> x: number
2. y: number
3. width: number
4. height: number
Gets the current scissor box.
@return x — The x-component of the top-left point of the box.
@return y — The y-component of the top-left point of the box.
@return width — The width of the box.
@return height — The height of the box.
getShader
function love.graphics.getShader()
-> shader: love.Shader
Gets the current Shader. Returns nil if none is set.
@return shader — The currently active Shader, or nil if none is set.
getStackDepth
function love.graphics.getStackDepth()
-> depth: number
Gets the current depth of the transform / state stack (the number of pushes without corresponding pops).
@return depth — The current depth of the transform and state love.graphics stack.
getStats
function love.graphics.getStats()
-> stats: { drawcalls: number, canvasswitches: number, texturememory: number, images: number, canvases: number, fonts: number, shaderswitches: number, drawcallsbatched: number }
Gets performance-related rendering statistics.
@return stats — A table with the following fields:
getStencilTest
function love.graphics.getStencilTest()
-> comparemode: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3)
2. comparevalue: number
Gets the current stencil test configuration.
When stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil.
Each Canvas has its own per-pixel stencil values.
@return comparemode — The type of comparison that is made for each pixel. Will be 'always' if stencil testing is disabled.
@return comparevalue — The value used when comparing with the stencil value of each pixel.
--
-- Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompareMode)
--
comparemode:
| "equal" -- * stencil tests: the stencil value of the pixel must be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.
| "notequal" -- * stencil tests: the stencil value of the pixel must not be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel.
| "less" -- * stencil tests: the stencil value of the pixel must be less than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.
| "lequal" -- * stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.
| "gequal" -- * stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.
| "greater" -- * stencil tests: the stencil value of the pixel must be greater than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.
| "never" -- Objects will never be drawn.
| "always" -- Objects will always be drawn. Effectively disables the depth or stencil test.
getSupported
function love.graphics.getSupported()
-> features: table
Gets the optional graphics features and whether they're supported on the system.
Some older or low-end systems don't always support all graphics features.
@return features — A table containing GraphicsFeature keys, and boolean values indicating whether each feature is supported.
getSystemLimits
function love.graphics.getSystemLimits()
-> limits: table
Gets the system-dependent maximum values for love.graphics features.
@return limits — A table containing GraphicsLimit keys, and number values.
getTextureTypes
function love.graphics.getTextureTypes()
-> texturetypes: table
Gets the available texture types, and whether each is supported.
@return texturetypes — A table containing TextureTypes as keys, and a boolean indicating whether the type is supported as values. Not all systems support all types.
getWidth
function love.graphics.getWidth()
-> width: number
Gets the width in pixels of the window.
@return width — The width of the window.
intersectScissor
function love.graphics.intersectScissor(x: number, y: number, width: number, height: number)
Sets the scissor to the rectangle created by the intersection of the specified rectangle with the existing scissor.
If no scissor is active yet, it behaves like love.graphics.setScissor.
The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear.
The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...).
@param x — The x-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.
@param y — The y-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.
@param width — The width of the rectangle to intersect with the existing scissor rectangle.
@param height — The height of the rectangle to intersect with the existing scissor rectangle.
inverseTransformPoint
function love.graphics.inverseTransformPoint(screenX: number, screenY: number)
-> globalX: number
2. globalY: number
Converts the given 2D position from screen-space into global coordinates.
This effectively applies the reverse of the current graphics transformations to the given position. A similar Transform:inverseTransformPoint method exists for Transform objects.
@param screenX — The x component of the screen-space position.
@param screenY — The y component of the screen-space position.
@return globalX — The x component of the position in global coordinates.
@return globalY — The y component of the position in global coordinates.
isActive
function love.graphics.isActive()
-> active: boolean
Gets whether the graphics module is able to be used. If it is not active, love.graphics function and method calls will not work correctly and may cause the program to crash. The graphics module is inactive if a window is not open, or if the app is in the background on iOS. Typically the app's execution will be automatically paused by the system, in the latter case.
@return active — Whether the graphics module is active and able to be used.
isGammaCorrect
function love.graphics.isGammaCorrect()
-> gammacorrect: boolean
Gets whether gamma-correct rendering is supported and enabled. It can be enabled by setting t.gammacorrect = true in love.conf.
Not all devices support gamma-correct rendering, in which case it will be automatically disabled and this function will return false. It is supported on desktop systems which have graphics cards that are capable of using OpenGL 3 / DirectX 10, and iOS devices that can use OpenGL ES 3.
@return gammacorrect — True if gamma-correct rendering is supported and was enabled in love.conf, false otherwise.
isWireframe
function love.graphics.isWireframe()
-> wireframe: boolean
Gets whether wireframe mode is used when drawing.
@return wireframe — True if wireframe lines are used when drawing, false if it's not.
line
function love.graphics.line(x1: number, y1: number, x2: number, y2: number, ...number)
Draws lines between points.
@param x1 — The position of first point on the x-axis.
@param y1 — The position of first point on the y-axis.
@param x2 — The position of second point on the x-axis.
@param y2 — The position of second point on the y-axis.
newArrayImage
function love.graphics.newArrayImage(slices: table, settings?: { mipmaps: boolean, linear: boolean, dpiscale: number })
-> image: love.Image
Creates a new array Image.
An array image / array texture is a single object which contains multiple 'layers' or 'slices' of 2D sub-images. It can be thought of similarly to a texture atlas or sprite sheet, but it doesn't suffer from the same tile / quad bleeding artifacts that texture atlases do – although every sub-image must have the same dimensions.
A specific layer of an array image can be drawn with love.graphics.drawLayer / SpriteBatch:addLayer, or with the Quad variant of love.graphics.draw and Quad:setLayer, or via a custom Shader.
To use an array image in a Shader, it must be declared as a ArrayImage or sampler2DArray type (instead of Image or sampler2D). The Texel(ArrayImage image, vec3 texturecoord) shader function must be used to get pixel colors from a slice of the array image. The vec3 argument contains the texture coordinate in the first two components, and the 0-based slice index in the third component.
@param slices — A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. Each sub-image must have the same dimensions. A table of tables can also be given, where each sub-table contains all mipmap levels for the slice index of that sub-table.
@param settings — Optional table of settings to configure the array image, containing the following fields:
@return image — An Array Image object.
newCanvas
function love.graphics.newCanvas()
-> canvas: love.Canvas
Creates a new Canvas object for offscreen rendering.
@return canvas — A new Canvas with dimensions equal to the window's size in pixels.
newCubeImage
function love.graphics.newCubeImage(filename: string, settings?: { mipmaps: boolean, linear: boolean })
-> image: love.Image
Creates a new cubemap Image.
Cubemap images have 6 faces (sides) which represent a cube. They can't be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send).
To use a cubemap image in a Shader, it must be declared as a CubeImage or samplerCube type (instead of Image or sampler2D). The Texel(CubeImage image, vec3 direction) shader function must be used to get pixel colors from the cubemap. The vec3 argument is a normalized direction from the center of the cube, rather than explicit texture coordinates.
Each face in a cubemap image must have square dimensions.
For variants of this function which accept a single image containing multiple cubemap faces, they must be laid out in one of the following forms in the image:
+y
+z +x -z
-y
-x
or:
+y
-x +z +x -z
-y
or:
+x
-x
+y
-y
+z
-z
or:
+x -x +y -y +z -z
@param filename — The filepath to a cubemap image file (or a File, FileData, or ImageData).
@param settings — Optional table of settings to configure the cubemap image, containing the following fields:
@return image — An cubemap Image object.
newFont
function love.graphics.newFont(filename: string)
-> font: love.Font
Creates a new Font from a TrueType Font or BMFont file. Created fonts are not cached, in that calling this function with the same arguments will always create a new Font object.
All variants which accept a filename can also accept a Data object instead.
@param filename — The filepath to the BMFont or TrueType font file.
@return font — A Font object which can be used to draw text on screen.
newImage
function love.graphics.newImage(filename: string, settings?: { dpiscale: number, linear: boolean, mipmaps: boolean })
-> image: love.Image
Creates a new Image from a filepath, FileData, an ImageData, or a CompressedImageData, and optionally generates or specifies mipmaps for the image.
@param filename — The filepath to the image file.
@param settings — A table containing the following fields:
@return image — A new Image object which can be drawn on screen.
newImageFont
function love.graphics.newImageFont(filename: string, glyphs: string)
-> font: love.Font
Creates a new specifically formatted image.
In versions prior to 0.9.0, LÖVE expects ISO 8859-1 encoding for the glyphs string.
@param filename — The filepath to the image file.
@param glyphs — A string of the characters in the image in order from left to right.
@return font — A Font object which can be used to draw text on screen.
newMesh
function love.graphics.newMesh(vertices: { ["1"]: number, ["2"]: number, ["3"]: number, ["4"]: number, ["5"]: number, ["6"]: number, ["7"]: number, ["8"]: number }, mode?: "fan"|"points"|"strip"|"triangles", usage?: "dynamic"|"static"|"stream")
-> mesh: love.Mesh
Creates a new Mesh.
Use Mesh:setTexture if the Mesh should be textured with an Image or Canvas when it's drawn.
In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.
@param vertices — The table filled with vertex information tables for each vertex as follows:
@param mode — How the vertices are used when drawing. The default mode 'fan' is sufficient for simple convex polygons.
@param usage — The expected usage of the Mesh. The specified usage mode affects the Mesh's memory usage and performance.
@return mesh — The new mesh.
--
-- How a Mesh's vertices are used when drawing.
--
--
-- [Open in Browser](https://love2d.org/wiki/MeshDrawMode)
--
mode:
| "fan" -- The vertices create a "fan" shape with the first vertex acting as the hub point. Can be easily used to draw simple convex polygons.
| "strip" -- The vertices create a series of connected triangles using vertices 1, 2, 3, then 3, 2, 4 (note the order), then 3, 4, 5, and so on.
| "triangles" -- The vertices create unconnected triangles.
| "points" -- The vertices are drawn as unconnected points (see love.graphics.setPointSize.)
--
-- Usage hints for SpriteBatches and Meshes to optimize data storage and access.
--
--
-- [Open in Browser](https://love2d.org/wiki/SpriteBatchUsage)
--
usage:
| "dynamic" -- The object's data will change occasionally during its lifetime.
| "static" -- The object will not be modified after initial sprites or vertices are added.
| "stream" -- The object data will always change between draws.
newParticleSystem
function love.graphics.newParticleSystem(image: love.Image, buffer?: number)
-> system: love.ParticleSystem
Creates a new ParticleSystem.
@param image — The image to use.
@param buffer — The max number of particles at the same time.
@return system — A new ParticleSystem.
newQuad
function love.graphics.newQuad(x: number, y: number, width: number, height: number, sw: number, sh: number)
-> quad: love.Quad
Creates a new Quad.
The purpose of a Quad is to use a fraction of an image to draw objects, as opposed to drawing entire image. It is most useful for sprite sheets and atlases: in a sprite atlas, multiple sprites reside in same image, quad is used to draw a specific sprite from that image; in animated sprites with all frames residing in the same image, quad is used to draw specific frame from the animation.
@param x — The top-left position in the Image along the x-axis.
@param y — The top-left position in the Image along the y-axis.
@param width — The width of the Quad in the Image. (Must be greater than 0.)
@param height — The height of the Quad in the Image. (Must be greater than 0.)
@param sw — The reference width, the width of the Image. (Must be greater than 0.)
@param sh — The reference height, the height of the Image. (Must be greater than 0.)
@return quad — The new Quad.
newShader
function love.graphics.newShader(code: string)
-> shader: love.Shader
Creates a new Shader object for hardware-accelerated vertex and pixel effects. A Shader contains either vertex shader code, pixel shader code, or both.
Shaders are small programs which are run on the graphics card when drawing. Vertex shaders are run once for each vertex (for example, an image has 4 vertices - one at each corner. A Mesh might have many more.) Pixel shaders are run once for each pixel on the screen which the drawn object touches. Pixel shader code is executed after all the object's vertices have been processed by the vertex shader.
@param code — The pixel shader or vertex shader code, or a filename pointing to a file with the code.
@return shader — A Shader object for use in drawing operations.
newSpriteBatch
function love.graphics.newSpriteBatch(image: love.Image, maxsprites?: number)
-> spriteBatch: love.SpriteBatch
Creates a new SpriteBatch object.
@param image — The Image to use for the sprites.
@param maxsprites — The maximum number of sprites that the SpriteBatch can contain at any given time. Since version 11.0, additional sprites added past this number will automatically grow the spritebatch.
@return spriteBatch — The new SpriteBatch.
newText
function love.graphics.newText(font: love.Font, textstring?: string)
-> text: love.Text
Creates a new drawable Text object.
@param font — The font to use for the text.
@param textstring — The initial string of text that the new Text object will contain. May be nil.
@return text — The new drawable Text object.
newVideo
function love.graphics.newVideo(filename: string)
-> video: love.Video
Creates a new drawable Video. Currently only Ogg Theora video files are supported.
@param filename — The file path to the Ogg Theora video file.
@return video — A new Video.
newVolumeImage
function love.graphics.newVolumeImage(layers: table, settings?: { mipmaps: boolean, linear: boolean })
-> image: love.Image
Creates a new volume (3D) Image.
Volume images are 3D textures with width, height, and depth. They can't be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send).
To use a volume image in a Shader, it must be declared as a VolumeImage or sampler3D type (instead of Image or sampler2D). The Texel(VolumeImage image, vec3 texcoords) shader function must be used to get pixel colors from the volume image. The vec3 argument is a normalized texture coordinate with the z component representing the depth to sample at (ranging from 1).
Volume images are typically used as lookup tables in shaders for color grading, for example, because sampling using a texture coordinate that is partway in between two pixels can interpolate across all 3 dimensions in the volume image, resulting in a smooth gradient even when a small-sized volume image is used as the lookup table.
Array images are a much better choice than volume images for storing multiple different sprites in a single array image for directly drawing them.
@param layers — A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. A table of tables can also be given, where each sub-table represents a single mipmap level and contains all layers for that mipmap.
@param settings — Optional table of settings to configure the volume image, containing the following fields:
@return image — A volume Image object.
origin
function love.graphics.origin()
Resets the current coordinate transformation.
This function is always used to reverse any previous calls to love.graphics.rotate, love.graphics.scale, love.graphics.shear or love.graphics.translate. It returns the current transformation state to its defaults.
points
function love.graphics.points(x: number, y: number, ...number)
Draws one or more points.
@param x — The position of the first point on the x-axis.
@param y — The position of the first point on the y-axis.
polygon
function love.graphics.polygon(mode: "fill"|"line", ...number)
Draw a polygon.
Following the mode argument, this function can accept multiple numeric arguments or a single table of numeric arguments. In either case the arguments are interpreted as alternating x and y coordinates of the polygon's vertices.
@param mode — How to draw the polygon.
--
-- Controls whether shapes are drawn as an outline, or filled.
--
--
-- [Open in Browser](https://love2d.org/wiki/DrawMode)
--
mode:
| "fill" -- Draw filled shape.
| "line" -- Draw outlined shape.
pop
function love.graphics.pop()
Pops the current coordinate transformation from the transformation stack.
This function is always used to reverse a previous push operation. It returns the current transformation state to what it was before the last preceding push.
present
function love.graphics.present()
Displays the results of drawing operations on the screen.
This function is used when writing your own love.run function. It presents all the results of your drawing operations on the screen. See the example in love.run for a typical use of this function.
function love.graphics.print(text: string|number, x?: number, y?: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
Draws text on screen. If no Font is set, one will be created and set (once) if needed.
As of LOVE 0.7.1, when using translation and scaling functions while drawing text, this function assumes the scale occurs first.
If you don't script with this in mind, the text won't be in the right position, or possibly even on screen.
love.graphics.print and love.graphics.printf both support UTF-8 encoding. You'll also need a proper Font for special characters.
In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.
@param text — The text to draw.
@param x — The position to draw the object (x-axis).
@param y — The position to draw the object (y-axis).
@param r — Orientation (radians).
@param sx — Scale factor (x-axis).
@param sy — Scale factor (y-axis).
@param ox — Origin offset (x-axis).
@param oy — Origin offset (y-axis).
@param kx — Shearing factor (x-axis).
@param ky — Shearing factor (y-axis).
printf
function love.graphics.printf(text: string|number, x: number, y: number, limit: number, align?: "center"|"justify"|"left"|"right", r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
Draws formatted text, with word wrap and alignment.
See additional notes in love.graphics.print.
The word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change.
In version 0.9.2 and earlier, wrapping was implemented by breaking up words by spaces and putting them back together to make sure things fit nicely within the limit provided. However, due to the way this is done, extra spaces between words would end up missing when printed on the screen, and some lines could overflow past the provided wrap limit. In version 0.10.0 and newer this is no longer the case.
In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.
@param text — A text string.
@param x — The position on the x-axis.
@param y — The position on the y-axis.
@param limit — Wrap the line after this many horizontal pixels.
@param align — The alignment.
@param r — Orientation (radians).
@param sx — Scale factor (x-axis).
@param sy — Scale factor (y-axis).
@param ox — Origin offset (x-axis).
@param oy — Origin offset (y-axis).
@param kx — Shearing factor (x-axis).
@param ky — Shearing factor (y-axis).
--
-- Text alignment.
--
--
-- [Open in Browser](https://love2d.org/wiki/AlignMode)
--
align:
| "center" -- Align text center.
| "left" -- Align text left.
| "right" -- Align text right.
| "justify" -- Align text both left and right.
push
function love.graphics.push()
Copies and pushes the current coordinate transformation to the transformation stack.
This function is always used to prepare for a corresponding pop operation later. It stores the current coordinate transformation state into the transformation stack and keeps it active. Later changes to the transformation can be undone by using the pop operation, which returns the coordinate transform to the state it was in before calling push.
rectangle
function love.graphics.rectangle(mode: "fill"|"line", x: number, y: number, width: number, height: number)
Draws a rectangle.
@param mode — How to draw the rectangle.
@param x — The position of top-left corner along the x-axis.
@param y — The position of top-left corner along the y-axis.
@param width — Width of the rectangle.
@param height — Height of the rectangle.
--
-- Controls whether shapes are drawn as an outline, or filled.
--
--
-- [Open in Browser](https://love2d.org/wiki/DrawMode)
--
mode:
| "fill" -- Draw filled shape.
| "line" -- Draw outlined shape.
replaceTransform
function love.graphics.replaceTransform(transform: love.Transform)
Replaces the current coordinate transformation with the given Transform object.
@param transform — The Transform object to replace the current graphics coordinate transform with.
reset
function love.graphics.reset()
Resets the current graphics settings.
Calling reset makes the current drawing color white, the current background color black, disables any active color component masks, disables wireframe mode and resets the current graphics transformation to the origin. It also sets both the point and line drawing modes to smooth and their sizes to 1.0.
rotate
function love.graphics.rotate(angle: number)
Rotates the coordinate system in two dimensions.
Calling this function affects all future drawing operations by rotating the coordinate system around the origin by the given amount of radians. This change lasts until love.draw() exits.
@param angle — The amount to rotate the coordinate system in radians.
scale
function love.graphics.scale(sx: number, sy?: number)
Scales the coordinate system in two dimensions.
By default the coordinate system in LÖVE corresponds to the display pixels in horizontal and vertical directions one-to-one, and the x-axis increases towards the right while the y-axis increases downwards. Scaling the coordinate system changes this relation.
After scaling by sx and sy, all coordinates are treated as if they were multiplied by sx and sy. Every result of a drawing operation is also correspondingly scaled, so scaling by (2, 2) for example would mean making everything twice as large in both x- and y-directions. Scaling by a negative value flips the coordinate system in the corresponding direction, which also means everything will be drawn flipped or upside down, or both. Scaling by zero is not a useful operation.
Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome.
Scaling lasts until love.draw() exits.
@param sx — The scaling in the direction of the x-axis.
@param sy — The scaling in the direction of the y-axis. If omitted, it defaults to same as parameter sx.
setBackgroundColor
function love.graphics.setBackgroundColor(red: number, green: number, blue: number, alpha?: number)
Sets the background color.
@param red — The red component (0-1).
@param green — The green component (0-1).
@param blue — The blue component (0-1).
@param alpha — The alpha component (0-1).
setBlendMode
function love.graphics.setBlendMode(mode: "add"|"additive"|"alpha"|"darken"|"lighten"...(+7))
Sets the blending mode.
@param mode — The blend mode to use.
--
-- Different ways to do color blending. See BlendAlphaMode and the BlendMode Formulas for additional notes.
--
--
-- [Open in Browser](https://love2d.org/wiki/BlendMode)
--
mode:
| "alpha" -- Alpha blending (normal). The alpha of what's drawn determines its opacity.
| "replace" -- The colors of what's drawn completely replace what was on the screen, with no additional blending. The BlendAlphaMode specified in love.graphics.setBlendMode still affects what happens.
| "screen" -- 'Screen' blending.
| "add" -- The pixel colors of what's drawn are added to the pixel colors already on the screen. The alpha of the screen is not modified.
| "subtract" -- The pixel colors of what's drawn are subtracted from the pixel colors already on the screen. The alpha of the screen is not modified.
| "multiply" -- The pixel colors of what's drawn are multiplied with the pixel colors already on the screen (darkening them). The alpha of drawn objects is multiplied with the alpha of the screen rather than determining how much the colors on the screen are affected, even when the "alphamultiply" BlendAlphaMode is used.
| "lighten" -- The pixel colors of what's drawn are compared to the existing pixel colors, and the larger of the two values for each color component is used. Only works when the "premultiplied" BlendAlphaMode is used in love.graphics.setBlendMode.
| "darken" -- The pixel colors of what's drawn are compared to the existing pixel colors, and the smaller of the two values for each color component is used. Only works when the "premultiplied" BlendAlphaMode is used in love.graphics.setBlendMode.
| "additive" -- Additive blend mode.
| "subtractive" -- Subtractive blend mode.
| "multiplicative" -- Multiply blend mode.
| "premultiplied" -- Premultiplied alpha blend mode.
setCanvas
function love.graphics.setCanvas(canvas: love.Canvas, mipmap?: number)
Captures drawing operations to a Canvas.
@param canvas — The new target.
@param mipmap — The mipmap level to render to, for Canvases with mipmaps.
setColor
function love.graphics.setColor(red: number, green: number, blue: number, alpha?: number)
Sets the color used for drawing.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@param red — The amount of red.
@param green — The amount of green.
@param blue — The amount of blue.
@param alpha — The amount of alpha. The alpha value will be applied to all subsequent draw operations, even the drawing of an image.
setColorMask
function love.graphics.setColorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean)
Sets the color mask. Enables or disables specific color components when rendering and clearing the screen. For example, if '''red''' is set to '''false''', no further changes will be made to the red component of any pixels.
@param red — Render red component.
@param green — Render green component.
@param blue — Render blue component.
@param alpha — Render alpha component.
setDefaultFilter
function love.graphics.setDefaultFilter(min: "linear"|"nearest", mag?: "linear"|"nearest", anisotropy?: number)
Sets the default scaling filters used with Images, Canvases, and Fonts.
@param min — Filter mode used when scaling the image down.
@param mag — Filter mode used when scaling the image up.
@param anisotropy — Maximum amount of Anisotropic Filtering used.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
min:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
--
-- How the image is filtered when scaling.
--
--
-- [Open in Browser](https://love2d.org/wiki/FilterMode)
--
mag:
| "linear" -- Scale image with linear interpolation.
| "nearest" -- Scale image with nearest neighbor interpolation.
setDepthMode
function love.graphics.setDepthMode(comparemode: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3), write: boolean)
Configures depth testing and writing to the depth buffer.
This is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images.
@param comparemode — Depth comparison mode used for depth testing.
@param write — Whether to write update / write values to the depth buffer when rendering.
--
-- Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompareMode)
--
comparemode:
| "equal" -- * stencil tests: the stencil value of the pixel must be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.
| "notequal" -- * stencil tests: the stencil value of the pixel must not be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel.
| "less" -- * stencil tests: the stencil value of the pixel must be less than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.
| "lequal" -- * stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.
| "gequal" -- * stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.
| "greater" -- * stencil tests: the stencil value of the pixel must be greater than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.
| "never" -- Objects will never be drawn.
| "always" -- Objects will always be drawn. Effectively disables the depth or stencil test.
setFont
function love.graphics.setFont(font: love.Font)
Set an already-loaded Font as the current font or create and load a new one from the file and size.
It's recommended that Font objects are created with love.graphics.newFont in the loading stage and then passed to this function in the drawing stage.
@param font — The Font object to use.
setFrontFaceWinding
function love.graphics.setFrontFaceWinding(winding: "ccw"|"cw")
Sets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing.
This is designed for use in combination with Mesh face culling. Other love.graphics shapes, lines, and sprites are not guaranteed to have a specific winding order to their internal vertices.
@param winding — The winding mode to use. The default winding is counterclockwise ('ccw').
--
-- How Mesh geometry vertices are ordered.
--
--
-- [Open in Browser](https://love2d.org/wiki/VertexWinding)
--
winding:
| "cw" -- Clockwise.
| "ccw" -- Counter-clockwise.
setLineJoin
function love.graphics.setLineJoin(join: "bevel"|"miter"|"none")
Sets the line join style. See LineJoin for the possible options.
@param join — The LineJoin to use.
--
-- Line join style.
--
--
-- [Open in Browser](https://love2d.org/wiki/LineJoin)
--
join:
| "miter" -- The ends of the line segments beveled in an angle so that they join seamlessly.
| "none" -- No cap applied to the ends of the line segments.
| "bevel" -- Flattens the point where line segments join together.
setLineStyle
function love.graphics.setLineStyle(style: "rough"|"smooth")
Sets the line style.
@param style — The LineStyle to use. Line styles include smooth and rough.
--
-- The styles in which lines are drawn.
--
--
-- [Open in Browser](https://love2d.org/wiki/LineStyle)
--
style:
| "rough" -- Draw rough lines.
| "smooth" -- Draw smooth lines.
setLineWidth
function love.graphics.setLineWidth(width: number)
Sets the line width.
@param width — The width of the line.
setMeshCullMode
function love.graphics.setMeshCullMode(mode: "back"|"front"|"none")
Sets whether back-facing triangles in a Mesh are culled.
This is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer.
By default, both front- and back-facing triangles in Meshes are rendered.
@param mode — The Mesh face culling mode to use (whether to render everything, cull back-facing triangles, or cull front-facing triangles).
--
-- How Mesh geometry is culled when rendering.
--
--
-- [Open in Browser](https://love2d.org/wiki/CullMode)
--
mode:
| "back" -- Back-facing triangles in Meshes are culled (not rendered). The vertex order of a triangle determines whether it is back- or front-facing.
| "front" -- Front-facing triangles in Meshes are culled.
| "none" -- Both back- and front-facing triangles in Meshes are rendered.
setNewFont
function love.graphics.setNewFont(size?: number)
-> font: love.Font
Creates and sets a new Font.
@param size — The size of the font.
@return font — The new font.
setPointSize
function love.graphics.setPointSize(size: number)
Sets the point size.
@param size — The new point size.
setScissor
function love.graphics.setScissor(x: number, y: number, width: number, height: number)
Sets or disables scissor.
The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear.
The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...).
@param x — x coordinate of upper left corner.
@param y — y coordinate of upper left corner.
@param width — width of clipping rectangle.
@param height — height of clipping rectangle.
setShader
function love.graphics.setShader(shader: love.Shader)
Sets or resets a Shader as the current pixel effect or vertex shaders. All drawing operations until the next ''love.graphics.setShader'' will be drawn using the Shader object specified.
@param shader — The new shader.
setStencilTest
function love.graphics.setStencilTest(comparemode: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3), comparevalue: number)
Configures or disables stencil testing.
When stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil.
@param comparemode — The type of comparison to make for each pixel.
@param comparevalue — The value to use when comparing with the stencil value of each pixel. Must be between 0 and 255.
--
-- Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/CompareMode)
--
comparemode:
| "equal" -- * stencil tests: the stencil value of the pixel must be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.
| "notequal" -- * stencil tests: the stencil value of the pixel must not be equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel.
| "less" -- * stencil tests: the stencil value of the pixel must be less than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.
| "lequal" -- * stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.
| "gequal" -- * stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.
| "greater" -- * stencil tests: the stencil value of the pixel must be greater than the supplied value.
-- * depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.
| "never" -- Objects will never be drawn.
| "always" -- Objects will always be drawn. Effectively disables the depth or stencil test.
setWireframe
function love.graphics.setWireframe(enable: boolean)
Sets whether wireframe lines will be used when drawing.
@param enable — True to enable wireframe mode when drawing, false to disable it.
shear
function love.graphics.shear(kx: number, ky: number)
Shears the coordinate system.
@param kx — The shear factor on the x-axis.
@param ky — The shear factor on the y-axis.
stencil
function love.graphics.stencil(stencilfunction: function, action?: "decrement"|"decrementwrap"|"increment"|"incrementwrap"|"invert"...(+1), value?: number, keepvalues?: boolean)
Draws geometry as a stencil.
The geometry drawn by the supplied function sets invisible stencil values of pixels, instead of setting pixel colors. The stencil buffer (which contains those stencil values) can act like a mask / stencil - love.graphics.setStencilTest can be used afterward to determine how further rendering is affected by the stencil values in each pixel.
Stencil values are integers within the range of 255.
@param stencilfunction — Function which draws geometry. The stencil values of pixels, rather than the color of each pixel, will be affected by the geometry.
@param action — How to modify any stencil values of pixels that are touched by what's drawn in the stencil function.
@param value — The new stencil value to use for pixels if the 'replace' stencil action is used. Has no effect with other stencil actions. Must be between 0 and 255.
@param keepvalues — True to preserve old stencil values of pixels, false to re-set every pixel's stencil value to 0 before executing the stencil function. love.graphics.clear will also re-set all stencil values.
--
-- How a stencil function modifies the stencil values of pixels it touches.
--
--
-- [Open in Browser](https://love2d.org/wiki/StencilAction)
--
action:
| "replace" -- The stencil value of a pixel will be replaced by the value specified in love.graphics.stencil, if any object touches the pixel.
| "increment" -- The stencil value of a pixel will be incremented by 1 for each object that touches the pixel. If the stencil value reaches 255 it will stay at 255.
| "decrement" -- The stencil value of a pixel will be decremented by 1 for each object that touches the pixel. If the stencil value reaches 0 it will stay at 0.
| "incrementwrap" -- The stencil value of a pixel will be incremented by 1 for each object that touches the pixel. If a stencil value of 255 is incremented it will be set to 0.
| "decrementwrap" -- The stencil value of a pixel will be decremented by 1 for each object that touches the pixel. If the stencil value of 0 is decremented it will be set to 255.
| "invert" -- The stencil value of a pixel will be bitwise-inverted for each object that touches the pixel. If a stencil value of 0 is inverted it will become 255.
transformPoint
function love.graphics.transformPoint(globalX: number, globalY: number)
-> screenX: number
2. screenY: number
Converts the given 2D position from global coordinates into screen-space.
This effectively applies the current graphics transformations to the given position. A similar Transform:transformPoint method exists for Transform objects.
@param globalX — The x component of the position in global coordinates.
@param globalY — The y component of the position in global coordinates.
@return screenX — The x component of the position with graphics transformations applied.
@return screenY — The y component of the position with graphics transformations applied.
translate
function love.graphics.translate(dx: number, dy: number)
Translates the coordinate system in two dimensions.
When this function is called with two numbers, dx, and dy, all the following drawing operations take effect as if their x and y coordinates were x+dx and y+dy.
Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome.
This change lasts until love.draw() exits or else a love.graphics.pop reverts to a previous love.graphics.push.
Translating using whole numbers will prevent tearing/blurring of images and fonts draw after translating.
@param dx — The translation relative to the x-axis.
@param dy — The translation relative to the y-axis.
validateShader
function love.graphics.validateShader(gles: boolean, code: string)
-> status: boolean
2. message: string
Validates shader code. Check if specified shader code does not contain any errors.
@param gles — Validate code as GLSL ES shader.
@param code — The pixel shader or vertex shader code, or a filename pointing to a file with the code.
@return status — true if specified shader code doesn't contain any errors. false otherwise.
@return message — Reason why shader code validation failed (or nil if validation succeded).
love.graphics
love.graphics
love.graphics.applyTransform
function love.graphics.applyTransform(transform: love.Transform)
love.graphics.arc
function love.graphics.arc(drawmode: "fill"|"line", x: number, y: number, radius: number, angle1: number, angle2: number, segments?: number)
love.graphics.captureScreenshot
function love.graphics.captureScreenshot(filename: string)
love.graphics.circle
function love.graphics.circle(mode: "fill"|"line", x: number, y: number, radius: number)
love.graphics.clear
function love.graphics.clear()
love.graphics.discard
function love.graphics.discard(discardcolor?: boolean, discardstencil?: boolean)
love.graphics.draw
function love.graphics.draw(drawable: love.Drawable, x?: number, y?: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
love.graphics.drawInstanced
function love.graphics.drawInstanced(mesh: love.Mesh, instancecount: number, x?: number, y?: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
love.graphics.drawLayer
function love.graphics.drawLayer(texture: love.Texture, layerindex: number, x?: number, y?: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
love.graphics.ellipse
function love.graphics.ellipse(mode: "fill"|"line", x: number, y: number, radiusx: number, radiusy: number)
love.graphics.flushBatch
function love.graphics.flushBatch()
love.graphics.getBackgroundColor
function love.graphics.getBackgroundColor()
-> r: number
2. g: number
3. b: number
4. a: number
love.graphics.getBlendMode
function love.graphics.getBlendMode()
-> mode: "add"|"additive"|"alpha"|"darken"|"lighten"...(+7)
2. alphamode: "alphamultiply"|"premultiplied"
love.graphics.getCanvas
function love.graphics.getCanvas()
-> canvas: love.Canvas
love.graphics.getCanvasFormats
function love.graphics.getCanvasFormats()
-> formats: table
love.graphics.getColor
function love.graphics.getColor()
-> r: number
2. g: number
3. b: number
4. a: number
love.graphics.getColorMask
function love.graphics.getColorMask()
-> r: boolean
2. g: boolean
3. b: boolean
4. a: boolean
love.graphics.getDPIScale
function love.graphics.getDPIScale()
-> scale: number
love.graphics.getDefaultFilter
function love.graphics.getDefaultFilter()
-> min: "linear"|"nearest"
2. mag: "linear"|"nearest"
3. anisotropy: number
love.graphics.getDepthMode
function love.graphics.getDepthMode()
-> comparemode: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3)
2. write: boolean
love.graphics.getDimensions
function love.graphics.getDimensions()
-> width: number
2. height: number
love.graphics.getFont
function love.graphics.getFont()
-> font: love.Font
love.graphics.getFrontFaceWinding
function love.graphics.getFrontFaceWinding()
-> winding: "ccw"|"cw"
love.graphics.getHeight
function love.graphics.getHeight()
-> height: number
love.graphics.getImageFormats
function love.graphics.getImageFormats()
-> formats: table
love.graphics.getLineJoin
function love.graphics.getLineJoin()
-> join: "bevel"|"miter"|"none"
love.graphics.getLineStyle
function love.graphics.getLineStyle()
-> style: "rough"|"smooth"
love.graphics.getLineWidth
function love.graphics.getLineWidth()
-> width: number
love.graphics.getMeshCullMode
function love.graphics.getMeshCullMode()
-> mode: "back"|"front"|"none"
love.graphics.getPixelDimensions
function love.graphics.getPixelDimensions()
-> pixelwidth: number
2. pixelheight: number
love.graphics.getPixelHeight
function love.graphics.getPixelHeight()
-> pixelheight: number
love.graphics.getPixelWidth
function love.graphics.getPixelWidth()
-> pixelwidth: number
love.graphics.getPointSize
function love.graphics.getPointSize()
-> size: number
love.graphics.getRendererInfo
function love.graphics.getRendererInfo()
-> name: string
2. version: string
3. vendor: string
4. device: string
love.graphics.getScissor
function love.graphics.getScissor()
-> x: number
2. y: number
3. width: number
4. height: number
love.graphics.getShader
function love.graphics.getShader()
-> shader: love.Shader
love.graphics.getStackDepth
function love.graphics.getStackDepth()
-> depth: number
love.graphics.getStats
function love.graphics.getStats()
-> stats: { drawcalls: number, canvasswitches: number, texturememory: number, images: number, canvases: number, fonts: number, shaderswitches: number, drawcallsbatched: number }
love.graphics.getStencilTest
function love.graphics.getStencilTest()
-> comparemode: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3)
2. comparevalue: number
love.graphics.getSupported
function love.graphics.getSupported()
-> features: table
love.graphics.getSystemLimits
function love.graphics.getSystemLimits()
-> limits: table
love.graphics.getTextureTypes
function love.graphics.getTextureTypes()
-> texturetypes: table
love.graphics.getWidth
function love.graphics.getWidth()
-> width: number
love.graphics.intersectScissor
function love.graphics.intersectScissor(x: number, y: number, width: number, height: number)
love.graphics.inverseTransformPoint
function love.graphics.inverseTransformPoint(screenX: number, screenY: number)
-> globalX: number
2. globalY: number
love.graphics.isActive
function love.graphics.isActive()
-> active: boolean
love.graphics.isGammaCorrect
function love.graphics.isGammaCorrect()
-> gammacorrect: boolean
love.graphics.isWireframe
function love.graphics.isWireframe()
-> wireframe: boolean
love.graphics.line
function love.graphics.line(x1: number, y1: number, x2: number, y2: number, ...number)
love.graphics.newArrayImage
function love.graphics.newArrayImage(slices: table, settings?: { mipmaps: boolean, linear: boolean, dpiscale: number })
-> image: love.Image
love.graphics.newCanvas
function love.graphics.newCanvas()
-> canvas: love.Canvas
love.graphics.newCubeImage
function love.graphics.newCubeImage(filename: string, settings?: { mipmaps: boolean, linear: boolean })
-> image: love.Image
love.graphics.newFont
function love.graphics.newFont(filename: string)
-> font: love.Font
love.graphics.newImage
function love.graphics.newImage(filename: string, settings?: { dpiscale: number, linear: boolean, mipmaps: boolean })
-> image: love.Image
love.graphics.newImageFont
function love.graphics.newImageFont(filename: string, glyphs: string)
-> font: love.Font
love.graphics.newMesh
function love.graphics.newMesh(vertices: { ["1"]: number, ["2"]: number, ["3"]: number, ["4"]: number, ["5"]: number, ["6"]: number, ["7"]: number, ["8"]: number }, mode?: "fan"|"points"|"strip"|"triangles", usage?: "dynamic"|"static"|"stream")
-> mesh: love.Mesh
love.graphics.newParticleSystem
function love.graphics.newParticleSystem(image: love.Image, buffer?: number)
-> system: love.ParticleSystem
love.graphics.newQuad
function love.graphics.newQuad(x: number, y: number, width: number, height: number, sw: number, sh: number)
-> quad: love.Quad
love.graphics.newShader
function love.graphics.newShader(code: string)
-> shader: love.Shader
love.graphics.newSpriteBatch
function love.graphics.newSpriteBatch(image: love.Image, maxsprites?: number)
-> spriteBatch: love.SpriteBatch
love.graphics.newText
function love.graphics.newText(font: love.Font, textstring?: string)
-> text: love.Text
love.graphics.newVideo
function love.graphics.newVideo(filename: string)
-> video: love.Video
love.graphics.newVolumeImage
function love.graphics.newVolumeImage(layers: table, settings?: { mipmaps: boolean, linear: boolean })
-> image: love.Image
love.graphics.origin
function love.graphics.origin()
love.graphics.points
function love.graphics.points(x: number, y: number, ...number)
love.graphics.polygon
function love.graphics.polygon(mode: "fill"|"line", ...number)
love.graphics.pop
function love.graphics.pop()
love.graphics.present
function love.graphics.present()
love.graphics.print
function love.graphics.print(text: string|number, x?: number, y?: number, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
love.graphics.printf
function love.graphics.printf(text: string|number, x: number, y: number, limit: number, align?: "center"|"justify"|"left"|"right", r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
love.graphics.push
function love.graphics.push()
love.graphics.rectangle
function love.graphics.rectangle(mode: "fill"|"line", x: number, y: number, width: number, height: number)
love.graphics.replaceTransform
function love.graphics.replaceTransform(transform: love.Transform)
love.graphics.reset
function love.graphics.reset()
love.graphics.rotate
function love.graphics.rotate(angle: number)
love.graphics.scale
function love.graphics.scale(sx: number, sy?: number)
love.graphics.setBackgroundColor
function love.graphics.setBackgroundColor(red: number, green: number, blue: number, alpha?: number)
love.graphics.setBlendMode
function love.graphics.setBlendMode(mode: "add"|"additive"|"alpha"|"darken"|"lighten"...(+7))
love.graphics.setCanvas
function love.graphics.setCanvas(canvas: love.Canvas, mipmap?: number)
love.graphics.setColor
function love.graphics.setColor(red: number, green: number, blue: number, alpha?: number)
love.graphics.setColorMask
function love.graphics.setColorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean)
love.graphics.setDefaultFilter
function love.graphics.setDefaultFilter(min: "linear"|"nearest", mag?: "linear"|"nearest", anisotropy?: number)
love.graphics.setDepthMode
function love.graphics.setDepthMode(comparemode: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3), write: boolean)
love.graphics.setFont
function love.graphics.setFont(font: love.Font)
love.graphics.setFrontFaceWinding
function love.graphics.setFrontFaceWinding(winding: "ccw"|"cw")
love.graphics.setLineJoin
function love.graphics.setLineJoin(join: "bevel"|"miter"|"none")
love.graphics.setLineStyle
function love.graphics.setLineStyle(style: "rough"|"smooth")
love.graphics.setLineWidth
function love.graphics.setLineWidth(width: number)
love.graphics.setMeshCullMode
function love.graphics.setMeshCullMode(mode: "back"|"front"|"none")
love.graphics.setNewFont
function love.graphics.setNewFont(size?: number)
-> font: love.Font
love.graphics.setPointSize
function love.graphics.setPointSize(size: number)
love.graphics.setScissor
function love.graphics.setScissor(x: number, y: number, width: number, height: number)
love.graphics.setShader
function love.graphics.setShader(shader: love.Shader)
love.graphics.setStencilTest
function love.graphics.setStencilTest(comparemode: "always"|"equal"|"gequal"|"greater"|"lequal"...(+3), comparevalue: number)
love.graphics.setWireframe
function love.graphics.setWireframe(enable: boolean)
love.graphics.shear
function love.graphics.shear(kx: number, ky: number)
love.graphics.stencil
function love.graphics.stencil(stencilfunction: function, action?: "decrement"|"decrementwrap"|"increment"|"incrementwrap"|"invert"...(+1), value?: number, keepvalues?: boolean)
love.graphics.transformPoint
function love.graphics.transformPoint(globalX: number, globalY: number)
-> screenX: number
2. screenY: number
love.graphics.translate
function love.graphics.translate(dx: number, dy: number)
love.graphics.validateShader
function love.graphics.validateShader(gles: boolean, code: string)
-> status: boolean
2. message: string
love.hasDeprecationOutput
function love.hasDeprecationOutput()
-> enabled: boolean
love.image
isCompressed
function love.image.isCompressed(filename: string)
-> compressed: boolean
Determines whether a file can be loaded as CompressedImageData.
@param filename — The filename of the potentially compressed image file.
@return compressed — Whether the file can be loaded as CompressedImageData or not.
newCompressedData
function love.image.newCompressedData(filename: string)
-> compressedImageData: love.CompressedImageData
Create a new CompressedImageData object from a compressed image file. LÖVE supports several compressed texture formats, enumerated in the CompressedImageFormat page.
@param filename — The filename of the compressed image file.
@return compressedImageData — The new CompressedImageData object.
newImageData
function love.image.newImageData(width: number, height: number)
-> imageData: love.ImageData
Creates a new ImageData object.
@param width — The width of the ImageData.
@param height — The height of the ImageData.
@return imageData — The new blank ImageData object. Each pixel's color values, (including the alpha values!) will be set to zero.
love.image
love.image
love.image.isCompressed
function love.image.isCompressed(filename: string)
-> compressed: boolean
love.image.newCompressedData
function love.image.newCompressedData(filename: string)
-> compressedImageData: love.CompressedImageData
love.image.newImageData
function love.image.newImageData(width: number, height: number)
-> imageData: love.ImageData
love.isVersionCompatible
function love.isVersionCompatible(version: string)
-> compatible: boolean
love.joystick
getGamepadMappingString
function love.joystick.getGamepadMappingString(guid: string)
-> mappingstring: string
Gets the full gamepad mapping string of the Joysticks which have the given GUID, or nil if the GUID isn't recognized as a gamepad.
The mapping string contains binding information used to map the Joystick's buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings.
@param guid — The GUID value to get the mapping string for.
@return mappingstring — A string containing the Joystick's gamepad mappings, or nil if the GUID is not recognized as a gamepad.
getJoystickCount
function love.joystick.getJoystickCount()
-> joystickcount: number
Gets the number of connected joysticks.
@return joystickcount — The number of connected joysticks.
getJoysticks
function love.joystick.getJoysticks()
-> joysticks: table
Gets a list of connected Joysticks.
@return joysticks — The list of currently connected Joysticks.
loadGamepadMappings
function love.joystick.loadGamepadMappings(filename: string)
Loads a gamepad mappings string or file created with love.joystick.saveGamepadMappings.
It also recognizes any SDL gamecontroller mapping string, such as those created with Steam's Big Picture controller configure interface, or this nice database. If a new mapping is loaded for an already known controller GUID, the later version will overwrite the one currently loaded.
@param filename — The filename to load the mappings string from.
saveGamepadMappings
function love.joystick.saveGamepadMappings(filename: string)
-> mappings: string
Saves the virtual gamepad mappings of all recognized as gamepads and have either been recently used or their gamepad bindings have been modified.
The mappings are stored as a string for use with love.joystick.loadGamepadMappings.
@param filename — The filename to save the mappings string to.
@return mappings — The mappings string that was written to the file.
setGamepadMapping
function love.joystick.setGamepadMapping(guid: string, button: "a"|"b"|"back"|"dpdown"|"dpleft"...(+10), inputtype: "axis"|"button"|"hat", inputindex: number, hatdir?: "c"|"d"|"l"|"ld"|"lu"...(+4))
-> success: boolean
Binds a virtual gamepad input to a button, axis or hat for all Joysticks of a certain type. For example, if this function is used with a GUID returned by a Dualshock 3 controller in OS X, the binding will affect Joystick:getGamepadAxis and Joystick:isGamepadDown for ''all'' Dualshock 3 controllers used with the game when run in OS X.
LÖVE includes built-in gamepad bindings for many common controllers. This function lets you change the bindings or add new ones for types of Joysticks which aren't recognized as gamepads by default.
The virtual gamepad buttons and axes are designed around the Xbox 360 controller layout.
@param guid — The OS-dependent GUID for the type of Joystick the binding will affect.
@param button — The virtual gamepad button to bind.
@param inputtype — The type of input to bind the virtual gamepad button to.
@param inputindex — The index of the axis, button, or hat to bind the virtual gamepad button to.
@param hatdir — The direction of the hat, if the virtual gamepad button will be bound to a hat. nil otherwise.
@return success — Whether the virtual gamepad button was successfully bound.
--
-- Virtual gamepad buttons.
--
--
-- [Open in Browser](https://love2d.org/wiki/GamepadButton)
--
button:
| "a" -- Bottom face button (A).
| "b" -- Right face button (B).
| "x" -- Left face button (X).
| "y" -- Top face button (Y).
| "back" -- Back button.
| "guide" -- Guide button.
| "start" -- Start button.
| "leftstick" -- Left stick click button.
| "rightstick" -- Right stick click button.
| "leftshoulder" -- Left bumper.
| "rightshoulder" -- Right bumper.
| "dpup" -- D-pad up.
| "dpdown" -- D-pad down.
| "dpleft" -- D-pad left.
| "dpright" -- D-pad right.
--
-- Types of Joystick inputs.
--
--
-- [Open in Browser](https://love2d.org/wiki/JoystickInputType)
--
inputtype:
| "axis" -- Analog axis.
| "button" -- Button.
| "hat" -- 8-direction hat value.
--
-- Joystick hat positions.
--
--
-- [Open in Browser](https://love2d.org/wiki/JoystickHat)
--
hatdir:
| "c" -- Centered
| "d" -- Down
| "l" -- Left
| "ld" -- Left+Down
| "lu" -- Left+Up
| "r" -- Right
| "rd" -- Right+Down
| "ru" -- Right+Up
| "u" -- Up
love.joystick
love.joystick
love.joystick.getGamepadMappingString
function love.joystick.getGamepadMappingString(guid: string)
-> mappingstring: string
love.joystick.getJoystickCount
function love.joystick.getJoystickCount()
-> joystickcount: number
love.joystick.getJoysticks
function love.joystick.getJoysticks()
-> joysticks: table
love.joystick.loadGamepadMappings
function love.joystick.loadGamepadMappings(filename: string)
love.joystick.saveGamepadMappings
function love.joystick.saveGamepadMappings(filename: string)
-> mappings: string
love.joystick.setGamepadMapping
function love.joystick.setGamepadMapping(guid: string, button: "a"|"b"|"back"|"dpdown"|"dpleft"...(+10), inputtype: "axis"|"button"|"hat", inputindex: number, hatdir?: "c"|"d"|"l"|"ld"|"lu"...(+4))
-> success: boolean
love.joystickadded
love.joystickaxis
love.joystickhat
love.joystickpressed
love.joystickreleased
love.joystickremoved
love.keyboard
love.keyboard
love.keyboard
getKeyFromScancode
function love.keyboard.getKeyFromScancode(scancode: "'"|","|"-"|"."|"/"...(+189))
-> key: "!"|"#"|"$"|"&"|"'"...(+139)
Gets the key corresponding to the given hardware scancode.
Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode 'w' will be generated if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.
Scancodes are useful for creating default controls that have the same physical locations on on all systems.
@param scancode — The scancode to get the key from.
@return key — The key corresponding to the given scancode, or 'unknown' if the scancode doesn't map to a KeyConstant on the current system.
--
-- Keyboard scancodes.
--
-- Scancodes are keyboard layout-independent, so the scancode "w" will be generated if the key in the same place as the "w" key on an American QWERTY keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.
--
-- Using scancodes, rather than keycodes, is useful because keyboards with layouts differing from the US/UK layout(s) might have keys that generate 'unknown' keycodes, but the scancodes will still be detected. This however would necessitate having a list for each keyboard layout one would choose to support.
--
-- One could use textinput or textedited instead, but those only give back the end result of keys used, i.e. you can't get modifiers on their own from it, only the final symbols that were generated.
--
--
-- [Open in Browser](https://love2d.org/wiki/Scancode)
--
scancode:
| "a" -- The 'A' key on an American layout.
| "b" -- The 'B' key on an American layout.
| "c" -- The 'C' key on an American layout.
| "d" -- The 'D' key on an American layout.
| "e" -- The 'E' key on an American layout.
| "f" -- The 'F' key on an American layout.
| "g" -- The 'G' key on an American layout.
| "h" -- The 'H' key on an American layout.
| "i" -- The 'I' key on an American layout.
| "j" -- The 'J' key on an American layout.
| "k" -- The 'K' key on an American layout.
| "l" -- The 'L' key on an American layout.
| "m" -- The 'M' key on an American layout.
| "n" -- The 'N' key on an American layout.
| "o" -- The 'O' key on an American layout.
| "p" -- The 'P' key on an American layout.
| "q" -- The 'Q' key on an American layout.
| "r" -- The 'R' key on an American layout.
| "s" -- The 'S' key on an American layout.
| "t" -- The 'T' key on an American layout.
| "u" -- The 'U' key on an American layout.
| "v" -- The 'V' key on an American layout.
| "w" -- The 'W' key on an American layout.
| "x" -- The 'X' key on an American layout.
| "y" -- The 'Y' key on an American layout.
| "z" -- The 'Z' key on an American layout.
| "1" -- The '1' key on an American layout.
| "2" -- The '2' key on an American layout.
| "3" -- The '3' key on an American layout.
| "4" -- The '4' key on an American layout.
| "5" -- The '5' key on an American layout.
| "6" -- The '6' key on an American layout.
| "7" -- The '7' key on an American layout.
| "8" -- The '8' key on an American layout.
| "9" -- The '9' key on an American layout.
| "0" -- The '0' key on an American layout.
| "return" -- The 'return' / 'enter' key on an American layout.
| "escape" -- The 'escape' key on an American layout.
| "backspace" -- The 'backspace' key on an American layout.
| "tab" -- The 'tab' key on an American layout.
| "space" -- The spacebar on an American layout.
| "-" -- The minus key on an American layout.
| "=" -- The equals key on an American layout.
| "[" -- The left-bracket key on an American layout.
| "]" -- The right-bracket key on an American layout.
| "\" -- The backslash key on an American layout.
| "nonus#" -- The non-U.S. hash scancode.
| ";" -- The semicolon key on an American layout.
| "'" -- The apostrophe key on an American layout.
| "`" -- The back-tick / grave key on an American layout.
| "," -- The comma key on an American layout.
| "." -- The period key on an American layout.
| "/" -- The forward-slash key on an American layout.
| "capslock" -- The capslock key on an American layout.
| "f1" -- The F1 key on an American layout.
| "f2" -- The F2 key on an American layout.
| "f3" -- The F3 key on an American layout.
| "f4" -- The F4 key on an American layout.
| "f5" -- The F5 key on an American layout.
| "f6" -- The F6 key on an American layout.
| "f7" -- The F7 key on an American layout.
| "f8" -- The F8 key on an American layout.
| "f9" -- The F9 key on an American layout.
| "f10" -- The F10 key on an American layout.
| "f11" -- The F11 key on an American layout.
| "f12" -- The F12 key on an American layout.
| "f13" -- The F13 key on an American layout.
| "f14" -- The F14 key on an American layout.
| "f15" -- The F15 key on an American layout.
| "f16" -- The F16 key on an American layout.
| "f17" -- The F17 key on an American layout.
| "f18" -- The F18 key on an American layout.
| "f19" -- The F19 key on an American layout.
| "f20" -- The F20 key on an American layout.
| "f21" -- The F21 key on an American layout.
| "f22" -- The F22 key on an American layout.
| "f23" -- The F23 key on an American layout.
| "f24" -- The F24 key on an American layout.
| "lctrl" -- The left control key on an American layout.
| "lshift" -- The left shift key on an American layout.
| "lalt" -- The left alt / option key on an American layout.
| "lgui" -- The left GUI (command / windows / super) key on an American layout.
| "rctrl" -- The right control key on an American layout.
| "rshift" -- The right shift key on an American layout.
| "ralt" -- The right alt / option key on an American layout.
| "rgui" -- The right GUI (command / windows / super) key on an American layout.
| "printscreen" -- The printscreen key on an American layout.
| "scrolllock" -- The scroll-lock key on an American layout.
| "pause" -- The pause key on an American layout.
| "insert" -- The insert key on an American layout.
| "home" -- The home key on an American layout.
| "numlock" -- The numlock / clear key on an American layout.
| "pageup" -- The page-up key on an American layout.
| "delete" -- The forward-delete key on an American layout.
| "end" -- The end key on an American layout.
| "pagedown" -- The page-down key on an American layout.
| "right" -- The right-arrow key on an American layout.
| "left" -- The left-arrow key on an American layout.
| "down" -- The down-arrow key on an American layout.
| "up" -- The up-arrow key on an American layout.
| "nonusbackslash" -- The non-U.S. backslash scancode.
| "application" -- The application key on an American layout. Windows contextual menu, compose key.
| "execute" -- The 'execute' key on an American layout.
| "help" -- The 'help' key on an American layout.
| "menu" -- The 'menu' key on an American layout.
| "select" -- The 'select' key on an American layout.
| "stop" -- The 'stop' key on an American layout.
| "again" -- The 'again' key on an American layout.
| "undo" -- The 'undo' key on an American layout.
| "cut" -- The 'cut' key on an American layout.
| "copy" -- The 'copy' key on an American layout.
| "paste" -- The 'paste' key on an American layout.
| "find" -- The 'find' key on an American layout.
| "kp/" -- The keypad forward-slash key on an American layout.
| "kp*" -- The keypad '*' key on an American layout.
| "kp-" -- The keypad minus key on an American layout.
| "kp+" -- The keypad plus key on an American layout.
| "kp=" -- The keypad equals key on an American layout.
| "kpenter" -- The keypad enter key on an American layout.
| "kp1" -- The keypad '1' key on an American layout.
| "kp2" -- The keypad '2' key on an American layout.
| "kp3" -- The keypad '3' key on an American layout.
| "kp4" -- The keypad '4' key on an American layout.
| "kp5" -- The keypad '5' key on an American layout.
| "kp6" -- The keypad '6' key on an American layout.
| "kp7" -- The keypad '7' key on an American layout.
| "kp8" -- The keypad '8' key on an American layout.
| "kp9" -- The keypad '9' key on an American layout.
| "kp0" -- The keypad '0' key on an American layout.
| "kp." -- The keypad period key on an American layout.
| "international1" -- The 1st international key on an American layout. Used on Asian keyboards.
| "international2" -- The 2nd international key on an American layout.
| "international3" -- The 3rd international key on an American layout. Yen.
| "international4" -- The 4th international key on an American layout.
| "international5" -- The 5th international key on an American layout.
| "international6" -- The 6th international key on an American layout.
| "international7" -- The 7th international key on an American layout.
| "international8" -- The 8th international key on an American layout.
| "international9" -- The 9th international key on an American layout.
| "lang1" -- Hangul/English toggle scancode.
| "lang2" -- Hanja conversion scancode.
| "lang3" -- Katakana scancode.
| "lang4" -- Hiragana scancode.
| "lang5" -- Zenkaku/Hankaku scancode.
| "mute" -- The mute key on an American layout.
| "volumeup" -- The volume up key on an American layout.
| "volumedown" -- The volume down key on an American layout.
| "audionext" -- The audio next track key on an American layout.
| "audioprev" -- The audio previous track key on an American layout.
| "audiostop" -- The audio stop key on an American layout.
| "audioplay" -- The audio play key on an American layout.
| "audiomute" -- The audio mute key on an American layout.
| "mediaselect" -- The media select key on an American layout.
| "www" -- The 'WWW' key on an American layout.
| "mail" -- The Mail key on an American layout.
| "calculator" -- The calculator key on an American layout.
| "computer" -- The 'computer' key on an American layout.
| "acsearch" -- The AC Search key on an American layout.
| "achome" -- The AC Home key on an American layout.
| "acback" -- The AC Back key on an American layout.
| "acforward" -- The AC Forward key on an American layout.
| "acstop" -- Th AC Stop key on an American layout.
| "acrefresh" -- The AC Refresh key on an American layout.
| "acbookmarks" -- The AC Bookmarks key on an American layout.
| "power" -- The system power scancode.
| "brightnessdown" -- The brightness-down scancode.
| "brightnessup" -- The brightness-up scancode.
| "displayswitch" -- The display switch scancode.
| "kbdillumtoggle" -- The keyboard illumination toggle scancode.
| "kbdillumdown" -- The keyboard illumination down scancode.
| "kbdillumup" -- The keyboard illumination up scancode.
| "eject" -- The eject scancode.
| "sleep" -- The system sleep scancode.
| "alterase" -- The alt-erase key on an American layout.
| "sysreq" -- The sysreq key on an American layout.
| "cancel" -- The 'cancel' key on an American layout.
| "clear" -- The 'clear' key on an American layout.
| "prior" -- The 'prior' key on an American layout.
| "return2" -- The 'return2' key on an American layout.
| "separator" -- The 'separator' key on an American layout.
| "out" -- The 'out' key on an American layout.
| "oper" -- The 'oper' key on an American layout.
| "clearagain" -- The 'clearagain' key on an American layout.
| "crsel" -- The 'crsel' key on an American layout.
| "exsel" -- The 'exsel' key on an American layout.
| "kp00" -- The keypad 00 key on an American layout.
| "kp000" -- The keypad 000 key on an American layout.
| "thsousandsseparator" -- The thousands-separator key on an American layout.
| "decimalseparator" -- The decimal separator key on an American layout.
| "currencyunit" -- The currency unit key on an American layout.
| "currencysubunit" -- The currency sub-unit key on an American layout.
| "app1" -- The 'app1' scancode.
| "app2" -- The 'app2' scancode.
| "unknown" -- An unknown key.
--
-- All the keys you can press. Note that some keys may not be available on your keyboard or system.
--
--
-- [Open in Browser](https://love2d.org/wiki/KeyConstant)
--
key:
| "a" -- The A key
| "b" -- The B key
| "c" -- The C key
| "d" -- The D key
| "e" -- The E key
| "f" -- The F key
| "g" -- The G key
| "h" -- The H key
| "i" -- The I key
| "j" -- The J key
| "k" -- The K key
| "l" -- The L key
| "m" -- The M key
| "n" -- The N key
| "o" -- The O key
| "p" -- The P key
| "q" -- The Q key
| "r" -- The R key
| "s" -- The S key
| "t" -- The T key
| "u" -- The U key
| "v" -- The V key
| "w" -- The W key
| "x" -- The X key
| "y" -- The Y key
| "z" -- The Z key
| "0" -- The zero key
| "1" -- The one key
| "2" -- The two key
| "3" -- The three key
| "4" -- The four key
| "5" -- The five key
| "6" -- The six key
| "7" -- The seven key
| "8" -- The eight key
| "9" -- The nine key
| "space" -- Space key
| "!" -- Exclamation mark key
| "\"" -- Double quote key
| "#" -- Hash key
| "$" -- Dollar key
| "&" -- Ampersand key
| "'" -- Single quote key
| "(" -- Left parenthesis key
| ")" -- Right parenthesis key
| "*" -- Asterisk key
| "+" -- Plus key
| "," -- Comma key
| "-" -- Hyphen-minus key
| "." -- Full stop key
| "/" -- Slash key
| ":" -- Colon key
| ";" -- Semicolon key
| "<" -- Less-than key
| "=" -- Equal key
| ">" -- Greater-than key
| "?" -- Question mark key
| "@" -- At sign key
| "[" -- Left square bracket key
| "\" -- Backslash key
| "]" -- Right square bracket key
| "^" -- Caret key
| "_" -- Underscore key
| "`" -- Grave accent key
| "kp0" -- The numpad zero key
| "kp1" -- The numpad one key
| "kp2" -- The numpad two key
| "kp3" -- The numpad three key
| "kp4" -- The numpad four key
| "kp5" -- The numpad five key
| "kp6" -- The numpad six key
| "kp7" -- The numpad seven key
| "kp8" -- The numpad eight key
| "kp9" -- The numpad nine key
| "kp." -- The numpad decimal point key
| "kp/" -- The numpad division key
| "kp*" -- The numpad multiplication key
| "kp-" -- The numpad substraction key
| "kp+" -- The numpad addition key
| "kpenter" -- The numpad enter key
| "kp=" -- The numpad equals key
| "up" -- Up cursor key
| "down" -- Down cursor key
| "right" -- Right cursor key
| "left" -- Left cursor key
| "home" -- Home key
| "end" -- End key
| "pageup" -- Page up key
| "pagedown" -- Page down key
| "insert" -- Insert key
| "backspace" -- Backspace key
| "tab" -- Tab key
| "clear" -- Clear key
| "return" -- Return key
| "delete" -- Delete key
| "f1" -- The 1st function key
| "f2" -- The 2nd function key
| "f3" -- The 3rd function key
| "f4" -- The 4th function key
| "f5" -- The 5th function key
| "f6" -- The 6th function key
| "f7" -- The 7th function key
| "f8" -- The 8th function key
| "f9" -- The 9th function key
| "f10" -- The 10th function key
| "f11" -- The 11th function key
| "f12" -- The 12th function key
| "f13" -- The 13th function key
| "f14" -- The 14th function key
| "f15" -- The 15th function key
| "numlock" -- Num-lock key
| "capslock" -- Caps-lock key
| "scrollock" -- Scroll-lock key
| "rshift" -- Right shift key
| "lshift" -- Left shift key
| "rctrl" -- Right control key
| "lctrl" -- Left control key
| "ralt" -- Right alt key
| "lalt" -- Left alt key
| "rmeta" -- Right meta key
| "lmeta" -- Left meta key
| "lsuper" -- Left super key
| "rsuper" -- Right super key
| "mode" -- Mode key
| "compose" -- Compose key
| "pause" -- Pause key
| "escape" -- Escape key
| "help" -- Help key
| "print" -- Print key
| "sysreq" -- System request key
| "break" -- Break key
| "menu" -- Menu key
| "power" -- Power key
| "euro" -- Euro (€) key
| "undo" -- Undo key
| "www" -- WWW key
| "mail" -- Mail key
| "calculator" -- Calculator key
| "appsearch" -- Application search key
| "apphome" -- Application home key
| "appback" -- Application back key
| "appforward" -- Application forward key
| "apprefresh" -- Application refresh key
| "appbookmarks" -- Application bookmarks key
getScancodeFromKey
function love.keyboard.getScancodeFromKey(key: "!"|"#"|"$"|"&"|"'"...(+139))
-> scancode: "'"|","|"-"|"."|"/"...(+189)
Gets the hardware scancode corresponding to the given key.
Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode 'w' will be generated if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.
Scancodes are useful for creating default controls that have the same physical locations on on all systems.
@param key — The key to get the scancode from.
@return scancode — The scancode corresponding to the given key, or 'unknown' if the given key has no known physical representation on the current system.
--
-- All the keys you can press. Note that some keys may not be available on your keyboard or system.
--
--
-- [Open in Browser](https://love2d.org/wiki/KeyConstant)
--
key:
| "a" -- The A key
| "b" -- The B key
| "c" -- The C key
| "d" -- The D key
| "e" -- The E key
| "f" -- The F key
| "g" -- The G key
| "h" -- The H key
| "i" -- The I key
| "j" -- The J key
| "k" -- The K key
| "l" -- The L key
| "m" -- The M key
| "n" -- The N key
| "o" -- The O key
| "p" -- The P key
| "q" -- The Q key
| "r" -- The R key
| "s" -- The S key
| "t" -- The T key
| "u" -- The U key
| "v" -- The V key
| "w" -- The W key
| "x" -- The X key
| "y" -- The Y key
| "z" -- The Z key
| "0" -- The zero key
| "1" -- The one key
| "2" -- The two key
| "3" -- The three key
| "4" -- The four key
| "5" -- The five key
| "6" -- The six key
| "7" -- The seven key
| "8" -- The eight key
| "9" -- The nine key
| "space" -- Space key
| "!" -- Exclamation mark key
| "\"" -- Double quote key
| "#" -- Hash key
| "$" -- Dollar key
| "&" -- Ampersand key
| "'" -- Single quote key
| "(" -- Left parenthesis key
| ")" -- Right parenthesis key
| "*" -- Asterisk key
| "+" -- Plus key
| "," -- Comma key
| "-" -- Hyphen-minus key
| "." -- Full stop key
| "/" -- Slash key
| ":" -- Colon key
| ";" -- Semicolon key
| "<" -- Less-than key
| "=" -- Equal key
| ">" -- Greater-than key
| "?" -- Question mark key
| "@" -- At sign key
| "[" -- Left square bracket key
| "\" -- Backslash key
| "]" -- Right square bracket key
| "^" -- Caret key
| "_" -- Underscore key
| "`" -- Grave accent key
| "kp0" -- The numpad zero key
| "kp1" -- The numpad one key
| "kp2" -- The numpad two key
| "kp3" -- The numpad three key
| "kp4" -- The numpad four key
| "kp5" -- The numpad five key
| "kp6" -- The numpad six key
| "kp7" -- The numpad seven key
| "kp8" -- The numpad eight key
| "kp9" -- The numpad nine key
| "kp." -- The numpad decimal point key
| "kp/" -- The numpad division key
| "kp*" -- The numpad multiplication key
| "kp-" -- The numpad substraction key
| "kp+" -- The numpad addition key
| "kpenter" -- The numpad enter key
| "kp=" -- The numpad equals key
| "up" -- Up cursor key
| "down" -- Down cursor key
| "right" -- Right cursor key
| "left" -- Left cursor key
| "home" -- Home key
| "end" -- End key
| "pageup" -- Page up key
| "pagedown" -- Page down key
| "insert" -- Insert key
| "backspace" -- Backspace key
| "tab" -- Tab key
| "clear" -- Clear key
| "return" -- Return key
| "delete" -- Delete key
| "f1" -- The 1st function key
| "f2" -- The 2nd function key
| "f3" -- The 3rd function key
| "f4" -- The 4th function key
| "f5" -- The 5th function key
| "f6" -- The 6th function key
| "f7" -- The 7th function key
| "f8" -- The 8th function key
| "f9" -- The 9th function key
| "f10" -- The 10th function key
| "f11" -- The 11th function key
| "f12" -- The 12th function key
| "f13" -- The 13th function key
| "f14" -- The 14th function key
| "f15" -- The 15th function key
| "numlock" -- Num-lock key
| "capslock" -- Caps-lock key
| "scrollock" -- Scroll-lock key
| "rshift" -- Right shift key
| "lshift" -- Left shift key
| "rctrl" -- Right control key
| "lctrl" -- Left control key
| "ralt" -- Right alt key
| "lalt" -- Left alt key
| "rmeta" -- Right meta key
| "lmeta" -- Left meta key
| "lsuper" -- Left super key
| "rsuper" -- Right super key
| "mode" -- Mode key
| "compose" -- Compose key
| "pause" -- Pause key
| "escape" -- Escape key
| "help" -- Help key
| "print" -- Print key
| "sysreq" -- System request key
| "break" -- Break key
| "menu" -- Menu key
| "power" -- Power key
| "euro" -- Euro (€) key
| "undo" -- Undo key
| "www" -- WWW key
| "mail" -- Mail key
| "calculator" -- Calculator key
| "appsearch" -- Application search key
| "apphome" -- Application home key
| "appback" -- Application back key
| "appforward" -- Application forward key
| "apprefresh" -- Application refresh key
| "appbookmarks" -- Application bookmarks key
--
-- Keyboard scancodes.
--
-- Scancodes are keyboard layout-independent, so the scancode "w" will be generated if the key in the same place as the "w" key on an American QWERTY keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.
--
-- Using scancodes, rather than keycodes, is useful because keyboards with layouts differing from the US/UK layout(s) might have keys that generate 'unknown' keycodes, but the scancodes will still be detected. This however would necessitate having a list for each keyboard layout one would choose to support.
--
-- One could use textinput or textedited instead, but those only give back the end result of keys used, i.e. you can't get modifiers on their own from it, only the final symbols that were generated.
--
--
-- [Open in Browser](https://love2d.org/wiki/Scancode)
--
scancode:
| "a" -- The 'A' key on an American layout.
| "b" -- The 'B' key on an American layout.
| "c" -- The 'C' key on an American layout.
| "d" -- The 'D' key on an American layout.
| "e" -- The 'E' key on an American layout.
| "f" -- The 'F' key on an American layout.
| "g" -- The 'G' key on an American layout.
| "h" -- The 'H' key on an American layout.
| "i" -- The 'I' key on an American layout.
| "j" -- The 'J' key on an American layout.
| "k" -- The 'K' key on an American layout.
| "l" -- The 'L' key on an American layout.
| "m" -- The 'M' key on an American layout.
| "n" -- The 'N' key on an American layout.
| "o" -- The 'O' key on an American layout.
| "p" -- The 'P' key on an American layout.
| "q" -- The 'Q' key on an American layout.
| "r" -- The 'R' key on an American layout.
| "s" -- The 'S' key on an American layout.
| "t" -- The 'T' key on an American layout.
| "u" -- The 'U' key on an American layout.
| "v" -- The 'V' key on an American layout.
| "w" -- The 'W' key on an American layout.
| "x" -- The 'X' key on an American layout.
| "y" -- The 'Y' key on an American layout.
| "z" -- The 'Z' key on an American layout.
| "1" -- The '1' key on an American layout.
| "2" -- The '2' key on an American layout.
| "3" -- The '3' key on an American layout.
| "4" -- The '4' key on an American layout.
| "5" -- The '5' key on an American layout.
| "6" -- The '6' key on an American layout.
| "7" -- The '7' key on an American layout.
| "8" -- The '8' key on an American layout.
| "9" -- The '9' key on an American layout.
| "0" -- The '0' key on an American layout.
| "return" -- The 'return' / 'enter' key on an American layout.
| "escape" -- The 'escape' key on an American layout.
| "backspace" -- The 'backspace' key on an American layout.
| "tab" -- The 'tab' key on an American layout.
| "space" -- The spacebar on an American layout.
| "-" -- The minus key on an American layout.
| "=" -- The equals key on an American layout.
| "[" -- The left-bracket key on an American layout.
| "]" -- The right-bracket key on an American layout.
| "\" -- The backslash key on an American layout.
| "nonus#" -- The non-U.S. hash scancode.
| ";" -- The semicolon key on an American layout.
| "'" -- The apostrophe key on an American layout.
| "`" -- The back-tick / grave key on an American layout.
| "," -- The comma key on an American layout.
| "." -- The period key on an American layout.
| "/" -- The forward-slash key on an American layout.
| "capslock" -- The capslock key on an American layout.
| "f1" -- The F1 key on an American layout.
| "f2" -- The F2 key on an American layout.
| "f3" -- The F3 key on an American layout.
| "f4" -- The F4 key on an American layout.
| "f5" -- The F5 key on an American layout.
| "f6" -- The F6 key on an American layout.
| "f7" -- The F7 key on an American layout.
| "f8" -- The F8 key on an American layout.
| "f9" -- The F9 key on an American layout.
| "f10" -- The F10 key on an American layout.
| "f11" -- The F11 key on an American layout.
| "f12" -- The F12 key on an American layout.
| "f13" -- The F13 key on an American layout.
| "f14" -- The F14 key on an American layout.
| "f15" -- The F15 key on an American layout.
| "f16" -- The F16 key on an American layout.
| "f17" -- The F17 key on an American layout.
| "f18" -- The F18 key on an American layout.
| "f19" -- The F19 key on an American layout.
| "f20" -- The F20 key on an American layout.
| "f21" -- The F21 key on an American layout.
| "f22" -- The F22 key on an American layout.
| "f23" -- The F23 key on an American layout.
| "f24" -- The F24 key on an American layout.
| "lctrl" -- The left control key on an American layout.
| "lshift" -- The left shift key on an American layout.
| "lalt" -- The left alt / option key on an American layout.
| "lgui" -- The left GUI (command / windows / super) key on an American layout.
| "rctrl" -- The right control key on an American layout.
| "rshift" -- The right shift key on an American layout.
| "ralt" -- The right alt / option key on an American layout.
| "rgui" -- The right GUI (command / windows / super) key on an American layout.
| "printscreen" -- The printscreen key on an American layout.
| "scrolllock" -- The scroll-lock key on an American layout.
| "pause" -- The pause key on an American layout.
| "insert" -- The insert key on an American layout.
| "home" -- The home key on an American layout.
| "numlock" -- The numlock / clear key on an American layout.
| "pageup" -- The page-up key on an American layout.
| "delete" -- The forward-delete key on an American layout.
| "end" -- The end key on an American layout.
| "pagedown" -- The page-down key on an American layout.
| "right" -- The right-arrow key on an American layout.
| "left" -- The left-arrow key on an American layout.
| "down" -- The down-arrow key on an American layout.
| "up" -- The up-arrow key on an American layout.
| "nonusbackslash" -- The non-U.S. backslash scancode.
| "application" -- The application key on an American layout. Windows contextual menu, compose key.
| "execute" -- The 'execute' key on an American layout.
| "help" -- The 'help' key on an American layout.
| "menu" -- The 'menu' key on an American layout.
| "select" -- The 'select' key on an American layout.
| "stop" -- The 'stop' key on an American layout.
| "again" -- The 'again' key on an American layout.
| "undo" -- The 'undo' key on an American layout.
| "cut" -- The 'cut' key on an American layout.
| "copy" -- The 'copy' key on an American layout.
| "paste" -- The 'paste' key on an American layout.
| "find" -- The 'find' key on an American layout.
| "kp/" -- The keypad forward-slash key on an American layout.
| "kp*" -- The keypad '*' key on an American layout.
| "kp-" -- The keypad minus key on an American layout.
| "kp+" -- The keypad plus key on an American layout.
| "kp=" -- The keypad equals key on an American layout.
| "kpenter" -- The keypad enter key on an American layout.
| "kp1" -- The keypad '1' key on an American layout.
| "kp2" -- The keypad '2' key on an American layout.
| "kp3" -- The keypad '3' key on an American layout.
| "kp4" -- The keypad '4' key on an American layout.
| "kp5" -- The keypad '5' key on an American layout.
| "kp6" -- The keypad '6' key on an American layout.
| "kp7" -- The keypad '7' key on an American layout.
| "kp8" -- The keypad '8' key on an American layout.
| "kp9" -- The keypad '9' key on an American layout.
| "kp0" -- The keypad '0' key on an American layout.
| "kp." -- The keypad period key on an American layout.
| "international1" -- The 1st international key on an American layout. Used on Asian keyboards.
| "international2" -- The 2nd international key on an American layout.
| "international3" -- The 3rd international key on an American layout. Yen.
| "international4" -- The 4th international key on an American layout.
| "international5" -- The 5th international key on an American layout.
| "international6" -- The 6th international key on an American layout.
| "international7" -- The 7th international key on an American layout.
| "international8" -- The 8th international key on an American layout.
| "international9" -- The 9th international key on an American layout.
| "lang1" -- Hangul/English toggle scancode.
| "lang2" -- Hanja conversion scancode.
| "lang3" -- Katakana scancode.
| "lang4" -- Hiragana scancode.
| "lang5" -- Zenkaku/Hankaku scancode.
| "mute" -- The mute key on an American layout.
| "volumeup" -- The volume up key on an American layout.
| "volumedown" -- The volume down key on an American layout.
| "audionext" -- The audio next track key on an American layout.
| "audioprev" -- The audio previous track key on an American layout.
| "audiostop" -- The audio stop key on an American layout.
| "audioplay" -- The audio play key on an American layout.
| "audiomute" -- The audio mute key on an American layout.
| "mediaselect" -- The media select key on an American layout.
| "www" -- The 'WWW' key on an American layout.
| "mail" -- The Mail key on an American layout.
| "calculator" -- The calculator key on an American layout.
| "computer" -- The 'computer' key on an American layout.
| "acsearch" -- The AC Search key on an American layout.
| "achome" -- The AC Home key on an American layout.
| "acback" -- The AC Back key on an American layout.
| "acforward" -- The AC Forward key on an American layout.
| "acstop" -- Th AC Stop key on an American layout.
| "acrefresh" -- The AC Refresh key on an American layout.
| "acbookmarks" -- The AC Bookmarks key on an American layout.
| "power" -- The system power scancode.
| "brightnessdown" -- The brightness-down scancode.
| "brightnessup" -- The brightness-up scancode.
| "displayswitch" -- The display switch scancode.
| "kbdillumtoggle" -- The keyboard illumination toggle scancode.
| "kbdillumdown" -- The keyboard illumination down scancode.
| "kbdillumup" -- The keyboard illumination up scancode.
| "eject" -- The eject scancode.
| "sleep" -- The system sleep scancode.
| "alterase" -- The alt-erase key on an American layout.
| "sysreq" -- The sysreq key on an American layout.
| "cancel" -- The 'cancel' key on an American layout.
| "clear" -- The 'clear' key on an American layout.
| "prior" -- The 'prior' key on an American layout.
| "return2" -- The 'return2' key on an American layout.
| "separator" -- The 'separator' key on an American layout.
| "out" -- The 'out' key on an American layout.
| "oper" -- The 'oper' key on an American layout.
| "clearagain" -- The 'clearagain' key on an American layout.
| "crsel" -- The 'crsel' key on an American layout.
| "exsel" -- The 'exsel' key on an American layout.
| "kp00" -- The keypad 00 key on an American layout.
| "kp000" -- The keypad 000 key on an American layout.
| "thsousandsseparator" -- The thousands-separator key on an American layout.
| "decimalseparator" -- The decimal separator key on an American layout.
| "currencyunit" -- The currency unit key on an American layout.
| "currencysubunit" -- The currency sub-unit key on an American layout.
| "app1" -- The 'app1' scancode.
| "app2" -- The 'app2' scancode.
| "unknown" -- An unknown key.
hasKeyRepeat
function love.keyboard.hasKeyRepeat()
-> enabled: boolean
Gets whether key repeat is enabled.
@return enabled — Whether key repeat is enabled.
hasScreenKeyboard
function love.keyboard.hasScreenKeyboard()
-> supported: boolean
Gets whether screen keyboard is supported.
@return supported — Whether screen keyboard is supported.
hasTextInput
function love.keyboard.hasTextInput()
-> enabled: boolean
Gets whether text input events are enabled.
@return enabled — Whether text input events are enabled.
isDown
function love.keyboard.isDown(key: "!"|"#"|"$"|"&"|"'"...(+139))
-> down: boolean
Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased.
@param key — The key to check.
@return down — True if the key is down, false if not.
--
-- All the keys you can press. Note that some keys may not be available on your keyboard or system.
--
--
-- [Open in Browser](https://love2d.org/wiki/KeyConstant)
--
key:
| "a" -- The A key
| "b" -- The B key
| "c" -- The C key
| "d" -- The D key
| "e" -- The E key
| "f" -- The F key
| "g" -- The G key
| "h" -- The H key
| "i" -- The I key
| "j" -- The J key
| "k" -- The K key
| "l" -- The L key
| "m" -- The M key
| "n" -- The N key
| "o" -- The O key
| "p" -- The P key
| "q" -- The Q key
| "r" -- The R key
| "s" -- The S key
| "t" -- The T key
| "u" -- The U key
| "v" -- The V key
| "w" -- The W key
| "x" -- The X key
| "y" -- The Y key
| "z" -- The Z key
| "0" -- The zero key
| "1" -- The one key
| "2" -- The two key
| "3" -- The three key
| "4" -- The four key
| "5" -- The five key
| "6" -- The six key
| "7" -- The seven key
| "8" -- The eight key
| "9" -- The nine key
| "space" -- Space key
| "!" -- Exclamation mark key
| "\"" -- Double quote key
| "#" -- Hash key
| "$" -- Dollar key
| "&" -- Ampersand key
| "'" -- Single quote key
| "(" -- Left parenthesis key
| ")" -- Right parenthesis key
| "*" -- Asterisk key
| "+" -- Plus key
| "," -- Comma key
| "-" -- Hyphen-minus key
| "." -- Full stop key
| "/" -- Slash key
| ":" -- Colon key
| ";" -- Semicolon key
| "<" -- Less-than key
| "=" -- Equal key
| ">" -- Greater-than key
| "?" -- Question mark key
| "@" -- At sign key
| "[" -- Left square bracket key
| "\" -- Backslash key
| "]" -- Right square bracket key
| "^" -- Caret key
| "_" -- Underscore key
| "`" -- Grave accent key
| "kp0" -- The numpad zero key
| "kp1" -- The numpad one key
| "kp2" -- The numpad two key
| "kp3" -- The numpad three key
| "kp4" -- The numpad four key
| "kp5" -- The numpad five key
| "kp6" -- The numpad six key
| "kp7" -- The numpad seven key
| "kp8" -- The numpad eight key
| "kp9" -- The numpad nine key
| "kp." -- The numpad decimal point key
| "kp/" -- The numpad division key
| "kp*" -- The numpad multiplication key
| "kp-" -- The numpad substraction key
| "kp+" -- The numpad addition key
| "kpenter" -- The numpad enter key
| "kp=" -- The numpad equals key
| "up" -- Up cursor key
| "down" -- Down cursor key
| "right" -- Right cursor key
| "left" -- Left cursor key
| "home" -- Home key
| "end" -- End key
| "pageup" -- Page up key
| "pagedown" -- Page down key
| "insert" -- Insert key
| "backspace" -- Backspace key
| "tab" -- Tab key
| "clear" -- Clear key
| "return" -- Return key
| "delete" -- Delete key
| "f1" -- The 1st function key
| "f2" -- The 2nd function key
| "f3" -- The 3rd function key
| "f4" -- The 4th function key
| "f5" -- The 5th function key
| "f6" -- The 6th function key
| "f7" -- The 7th function key
| "f8" -- The 8th function key
| "f9" -- The 9th function key
| "f10" -- The 10th function key
| "f11" -- The 11th function key
| "f12" -- The 12th function key
| "f13" -- The 13th function key
| "f14" -- The 14th function key
| "f15" -- The 15th function key
| "numlock" -- Num-lock key
| "capslock" -- Caps-lock key
| "scrollock" -- Scroll-lock key
| "rshift" -- Right shift key
| "lshift" -- Left shift key
| "rctrl" -- Right control key
| "lctrl" -- Left control key
| "ralt" -- Right alt key
| "lalt" -- Left alt key
| "rmeta" -- Right meta key
| "lmeta" -- Left meta key
| "lsuper" -- Left super key
| "rsuper" -- Right super key
| "mode" -- Mode key
| "compose" -- Compose key
| "pause" -- Pause key
| "escape" -- Escape key
| "help" -- Help key
| "print" -- Print key
| "sysreq" -- System request key
| "break" -- Break key
| "menu" -- Menu key
| "power" -- Power key
| "euro" -- Euro (€) key
| "undo" -- Undo key
| "www" -- WWW key
| "mail" -- Mail key
| "calculator" -- Calculator key
| "appsearch" -- Application search key
| "apphome" -- Application home key
| "appback" -- Application back key
| "appforward" -- Application forward key
| "apprefresh" -- Application refresh key
| "appbookmarks" -- Application bookmarks key
isScancodeDown
function love.keyboard.isScancodeDown(scancode: "'"|","|"-"|"."|"/"...(+189), ..."'"|","|"-"|"."|"/"...(+189))
-> down: boolean
Checks whether the specified Scancodes are pressed. Not to be confused with love.keypressed or love.keyreleased.
Unlike regular KeyConstants, Scancodes are keyboard layout-independent. The scancode 'w' is used if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.
@param scancode — A Scancode to check.
@return down — True if any supplied Scancode is down, false if not.
--
-- Keyboard scancodes.
--
-- Scancodes are keyboard layout-independent, so the scancode "w" will be generated if the key in the same place as the "w" key on an American QWERTY keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.
--
-- Using scancodes, rather than keycodes, is useful because keyboards with layouts differing from the US/UK layout(s) might have keys that generate 'unknown' keycodes, but the scancodes will still be detected. This however would necessitate having a list for each keyboard layout one would choose to support.
--
-- One could use textinput or textedited instead, but those only give back the end result of keys used, i.e. you can't get modifiers on their own from it, only the final symbols that were generated.
--
--
-- [Open in Browser](https://love2d.org/wiki/Scancode)
--
scancode:
| "a" -- The 'A' key on an American layout.
| "b" -- The 'B' key on an American layout.
| "c" -- The 'C' key on an American layout.
| "d" -- The 'D' key on an American layout.
| "e" -- The 'E' key on an American layout.
| "f" -- The 'F' key on an American layout.
| "g" -- The 'G' key on an American layout.
| "h" -- The 'H' key on an American layout.
| "i" -- The 'I' key on an American layout.
| "j" -- The 'J' key on an American layout.
| "k" -- The 'K' key on an American layout.
| "l" -- The 'L' key on an American layout.
| "m" -- The 'M' key on an American layout.
| "n" -- The 'N' key on an American layout.
| "o" -- The 'O' key on an American layout.
| "p" -- The 'P' key on an American layout.
| "q" -- The 'Q' key on an American layout.
| "r" -- The 'R' key on an American layout.
| "s" -- The 'S' key on an American layout.
| "t" -- The 'T' key on an American layout.
| "u" -- The 'U' key on an American layout.
| "v" -- The 'V' key on an American layout.
| "w" -- The 'W' key on an American layout.
| "x" -- The 'X' key on an American layout.
| "y" -- The 'Y' key on an American layout.
| "z" -- The 'Z' key on an American layout.
| "1" -- The '1' key on an American layout.
| "2" -- The '2' key on an American layout.
| "3" -- The '3' key on an American layout.
| "4" -- The '4' key on an American layout.
| "5" -- The '5' key on an American layout.
| "6" -- The '6' key on an American layout.
| "7" -- The '7' key on an American layout.
| "8" -- The '8' key on an American layout.
| "9" -- The '9' key on an American layout.
| "0" -- The '0' key on an American layout.
| "return" -- The 'return' / 'enter' key on an American layout.
| "escape" -- The 'escape' key on an American layout.
| "backspace" -- The 'backspace' key on an American layout.
| "tab" -- The 'tab' key on an American layout.
| "space" -- The spacebar on an American layout.
| "-" -- The minus key on an American layout.
| "=" -- The equals key on an American layout.
| "[" -- The left-bracket key on an American layout.
| "]" -- The right-bracket key on an American layout.
| "\" -- The backslash key on an American layout.
| "nonus#" -- The non-U.S. hash scancode.
| ";" -- The semicolon key on an American layout.
| "'" -- The apostrophe key on an American layout.
| "`" -- The back-tick / grave key on an American layout.
| "," -- The comma key on an American layout.
| "." -- The period key on an American layout.
| "/" -- The forward-slash key on an American layout.
| "capslock" -- The capslock key on an American layout.
| "f1" -- The F1 key on an American layout.
| "f2" -- The F2 key on an American layout.
| "f3" -- The F3 key on an American layout.
| "f4" -- The F4 key on an American layout.
| "f5" -- The F5 key on an American layout.
| "f6" -- The F6 key on an American layout.
| "f7" -- The F7 key on an American layout.
| "f8" -- The F8 key on an American layout.
| "f9" -- The F9 key on an American layout.
| "f10" -- The F10 key on an American layout.
| "f11" -- The F11 key on an American layout.
| "f12" -- The F12 key on an American layout.
| "f13" -- The F13 key on an American layout.
| "f14" -- The F14 key on an American layout.
| "f15" -- The F15 key on an American layout.
| "f16" -- The F16 key on an American layout.
| "f17" -- The F17 key on an American layout.
| "f18" -- The F18 key on an American layout.
| "f19" -- The F19 key on an American layout.
| "f20" -- The F20 key on an American layout.
| "f21" -- The F21 key on an American layout.
| "f22" -- The F22 key on an American layout.
| "f23" -- The F23 key on an American layout.
| "f24" -- The F24 key on an American layout.
| "lctrl" -- The left control key on an American layout.
| "lshift" -- The left shift key on an American layout.
| "lalt" -- The left alt / option key on an American layout.
| "lgui" -- The left GUI (command / windows / super) key on an American layout.
| "rctrl" -- The right control key on an American layout.
| "rshift" -- The right shift key on an American layout.
| "ralt" -- The right alt / option key on an American layout.
| "rgui" -- The right GUI (command / windows / super) key on an American layout.
| "printscreen" -- The printscreen key on an American layout.
| "scrolllock" -- The scroll-lock key on an American layout.
| "pause" -- The pause key on an American layout.
| "insert" -- The insert key on an American layout.
| "home" -- The home key on an American layout.
| "numlock" -- The numlock / clear key on an American layout.
| "pageup" -- The page-up key on an American layout.
| "delete" -- The forward-delete key on an American layout.
| "end" -- The end key on an American layout.
| "pagedown" -- The page-down key on an American layout.
| "right" -- The right-arrow key on an American layout.
| "left" -- The left-arrow key on an American layout.
| "down" -- The down-arrow key on an American layout.
| "up" -- The up-arrow key on an American layout.
| "nonusbackslash" -- The non-U.S. backslash scancode.
| "application" -- The application key on an American layout. Windows contextual menu, compose key.
| "execute" -- The 'execute' key on an American layout.
| "help" -- The 'help' key on an American layout.
| "menu" -- The 'menu' key on an American layout.
| "select" -- The 'select' key on an American layout.
| "stop" -- The 'stop' key on an American layout.
| "again" -- The 'again' key on an American layout.
| "undo" -- The 'undo' key on an American layout.
| "cut" -- The 'cut' key on an American layout.
| "copy" -- The 'copy' key on an American layout.
| "paste" -- The 'paste' key on an American layout.
| "find" -- The 'find' key on an American layout.
| "kp/" -- The keypad forward-slash key on an American layout.
| "kp*" -- The keypad '*' key on an American layout.
| "kp-" -- The keypad minus key on an American layout.
| "kp+" -- The keypad plus key on an American layout.
| "kp=" -- The keypad equals key on an American layout.
| "kpenter" -- The keypad enter key on an American layout.
| "kp1" -- The keypad '1' key on an American layout.
| "kp2" -- The keypad '2' key on an American layout.
| "kp3" -- The keypad '3' key on an American layout.
| "kp4" -- The keypad '4' key on an American layout.
| "kp5" -- The keypad '5' key on an American layout.
| "kp6" -- The keypad '6' key on an American layout.
| "kp7" -- The keypad '7' key on an American layout.
| "kp8" -- The keypad '8' key on an American layout.
| "kp9" -- The keypad '9' key on an American layout.
| "kp0" -- The keypad '0' key on an American layout.
| "kp." -- The keypad period key on an American layout.
| "international1" -- The 1st international key on an American layout. Used on Asian keyboards.
| "international2" -- The 2nd international key on an American layout.
| "international3" -- The 3rd international key on an American layout. Yen.
| "international4" -- The 4th international key on an American layout.
| "international5" -- The 5th international key on an American layout.
| "international6" -- The 6th international key on an American layout.
| "international7" -- The 7th international key on an American layout.
| "international8" -- The 8th international key on an American layout.
| "international9" -- The 9th international key on an American layout.
| "lang1" -- Hangul/English toggle scancode.
| "lang2" -- Hanja conversion scancode.
| "lang3" -- Katakana scancode.
| "lang4" -- Hiragana scancode.
| "lang5" -- Zenkaku/Hankaku scancode.
| "mute" -- The mute key on an American layout.
| "volumeup" -- The volume up key on an American layout.
| "volumedown" -- The volume down key on an American layout.
| "audionext" -- The audio next track key on an American layout.
| "audioprev" -- The audio previous track key on an American layout.
| "audiostop" -- The audio stop key on an American layout.
| "audioplay" -- The audio play key on an American layout.
| "audiomute" -- The audio mute key on an American layout.
| "mediaselect" -- The media select key on an American layout.
| "www" -- The 'WWW' key on an American layout.
| "mail" -- The Mail key on an American layout.
| "calculator" -- The calculator key on an American layout.
| "computer" -- The 'computer' key on an American layout.
| "acsearch" -- The AC Search key on an American layout.
| "achome" -- The AC Home key on an American layout.
| "acback" -- The AC Back key on an American layout.
| "acforward" -- The AC Forward key on an American layout.
| "acstop" -- Th AC Stop key on an American layout.
| "acrefresh" -- The AC Refresh key on an American layout.
| "acbookmarks" -- The AC Bookmarks key on an American layout.
| "power" -- The system power scancode.
| "brightnessdown" -- The brightness-down scancode.
| "brightnessup" -- The brightness-up scancode.
| "displayswitch" -- The display switch scancode.
| "kbdillumtoggle" -- The keyboard illumination toggle scancode.
| "kbdillumdown" -- The keyboard illumination down scancode.
| "kbdillumup" -- The keyboard illumination up scancode.
| "eject" -- The eject scancode.
| "sleep" -- The system sleep scancode.
| "alterase" -- The alt-erase key on an American layout.
| "sysreq" -- The sysreq key on an American layout.
| "cancel" -- The 'cancel' key on an American layout.
| "clear" -- The 'clear' key on an American layout.
| "prior" -- The 'prior' key on an American layout.
| "return2" -- The 'return2' key on an American layout.
| "separator" -- The 'separator' key on an American layout.
| "out" -- The 'out' key on an American layout.
| "oper" -- The 'oper' key on an American layout.
| "clearagain" -- The 'clearagain' key on an American layout.
| "crsel" -- The 'crsel' key on an American layout.
| "exsel" -- The 'exsel' key on an American layout.
| "kp00" -- The keypad 00 key on an American layout.
| "kp000" -- The keypad 000 key on an American layout.
| "thsousandsseparator" -- The thousands-separator key on an American layout.
| "decimalseparator" -- The decimal separator key on an American layout.
| "currencyunit" -- The currency unit key on an American layout.
| "currencysubunit" -- The currency sub-unit key on an American layout.
| "app1" -- The 'app1' scancode.
| "app2" -- The 'app2' scancode.
| "unknown" -- An unknown key.
setKeyRepeat
function love.keyboard.setKeyRepeat(enable: boolean)
Enables or disables key repeat for love.keypressed. It is disabled by default.
@param enable — Whether repeat keypress events should be enabled when a key is held down.
setTextInput
function love.keyboard.setTextInput(enable: boolean)
Enables or disables text input events. It is enabled by default on Windows, Mac, and Linux, and disabled by default on iOS and Android.
On touch devices, this shows the system's native on-screen keyboard when it's enabled.
@param enable — Whether text input events should be enabled.
love.keyboard.getKeyFromScancode
function love.keyboard.getKeyFromScancode(scancode: "'"|","|"-"|"."|"/"...(+189))
-> key: "!"|"#"|"$"|"&"|"'"...(+139)
love.keyboard.getScancodeFromKey
function love.keyboard.getScancodeFromKey(key: "!"|"#"|"$"|"&"|"'"...(+139))
-> scancode: "'"|","|"-"|"."|"/"...(+189)
love.keyboard.hasKeyRepeat
function love.keyboard.hasKeyRepeat()
-> enabled: boolean
love.keyboard.hasScreenKeyboard
function love.keyboard.hasScreenKeyboard()
-> supported: boolean
love.keyboard.hasTextInput
function love.keyboard.hasTextInput()
-> enabled: boolean
love.keyboard.isDown
function love.keyboard.isDown(key: "!"|"#"|"$"|"&"|"'"...(+139))
-> down: boolean
love.keyboard.isScancodeDown
function love.keyboard.isScancodeDown(scancode: "'"|","|"-"|"."|"/"...(+189), ..."'"|","|"-"|"."|"/"...(+189))
-> down: boolean
love.keyboard.setKeyRepeat
function love.keyboard.setKeyRepeat(enable: boolean)
love.keyboard.setTextInput
function love.keyboard.setTextInput(enable: boolean)
love.keypressed
love.keyreleased
love.load
love.lowmemory
love.math
love.math
love.math
colorFromBytes
function love.math.colorFromBytes(rb: number, gb: number, bb: number, ab?: number)
-> r: number
2. g: number
3. b: number
4. a: number
Converts a color from 0..255 to 0..1 range.
@param rb — Red color component in 0..255 range.
@param gb — Green color component in 0..255 range.
@param bb — Blue color component in 0..255 range.
@param ab — Alpha color component in 0..255 range.
@return r — Red color component in 0..1 range.
@return g — Green color component in 0..1 range.
@return b — Blue color component in 0..1 range.
@return a — Alpha color component in 0..1 range or nil if alpha is not specified.
colorToBytes
function love.math.colorToBytes(r: number, g: number, b: number, a?: number)
-> rb: number
2. gb: number
3. bb: number
4. ab: number
Converts a color from 0..1 to 0..255 range.
@param r — Red color component.
@param g — Green color component.
@param b — Blue color component.
@param a — Alpha color component.
@return rb — Red color component in 0..255 range.
@return gb — Green color component in 0..255 range.
@return bb — Blue color component in 0..255 range.
@return ab — Alpha color component in 0..255 range or nil if alpha is not specified.
gammaToLinear
function love.math.gammaToLinear(r: number, g: number, b: number)
-> lr: number
2. lg: number
3. lb: number
Converts a color from gamma-space (sRGB) to linear-space (RGB). This is useful when doing gamma-correct rendering and you need to do math in linear RGB in the few cases where LÖVE doesn't handle conversions automatically.
Read more about gamma-correct rendering here, here, and here.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@param r — The red channel of the sRGB color to convert.
@param g — The green channel of the sRGB color to convert.
@param b — The blue channel of the sRGB color to convert.
@return lr — The red channel of the converted color in linear RGB space.
@return lg — The green channel of the converted color in linear RGB space.
@return lb — The blue channel of the converted color in linear RGB space.
getRandomSeed
function love.math.getRandomSeed()
-> low: number
2. high: number
Gets the seed of the random number generator.
The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed can be an integer value up to 2^64.
@return low — Integer number representing the lower 32 bits of the random number generator's 64 bit seed value.
@return high — Integer number representing the higher 32 bits of the random number generator's 64 bit seed value.
getRandomState
function love.math.getRandomState()
-> state: string
Gets the current state of the random number generator. This returns an opaque implementation-dependent string which is only useful for later use with love.math.setRandomState or RandomGenerator:setState.
This is different from love.math.getRandomSeed in that getRandomState gets the random number generator's current state, whereas getRandomSeed gets the previously set seed number.
@return state — The current state of the random number generator, represented as a string.
isConvex
function love.math.isConvex(vertices: table)
-> convex: boolean
Checks whether a polygon is convex.
PolygonShapes in love.physics, some forms of Meshes, and polygons drawn with love.graphics.polygon must be simple convex polygons.
@param vertices — The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.
@return convex — Whether the given polygon is convex.
linearToGamma
function love.math.linearToGamma(lr: number, lg: number, lb: number)
-> cr: number
2. cg: number
3. cb: number
Converts a color from linear-space (RGB) to gamma-space (sRGB). This is useful when storing linear RGB color values in an image, because the linear RGB color space has less precision than sRGB for dark colors, which can result in noticeable color banding when drawing.
In general, colors chosen based on what they look like on-screen are already in gamma-space and should not be double-converted. Colors calculated using math are often in the linear RGB space.
Read more about gamma-correct rendering here, here, and here.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
@param lr — The red channel of the linear RGB color to convert.
@param lg — The green channel of the linear RGB color to convert.
@param lb — The blue channel of the linear RGB color to convert.
@return cr — The red channel of the converted color in gamma sRGB space.
@return cg — The green channel of the converted color in gamma sRGB space.
@return cb — The blue channel of the converted color in gamma sRGB space.
newBezierCurve
function love.math.newBezierCurve(vertices: table)
-> curve: love.BezierCurve
Creates a new BezierCurve object.
The number of vertices in the control polygon determines the degree of the curve, e.g. three vertices define a quadratic (degree 2) Bézier curve, four vertices define a cubic (degree 3) Bézier curve, etc.
@param vertices — The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.
@return curve — A Bézier curve object.
newRandomGenerator
function love.math.newRandomGenerator()
-> rng: love.RandomGenerator
Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions.
@return rng — The new Random Number Generator object.
newTransform
function love.math.newTransform()
-> transform: love.Transform
Creates a new Transform object.
@return transform — The new Transform object.
noise
function love.math.noise(x: number)
-> value: number
Generates a Simplex or Perlin noise value in 1-4 dimensions. The return value will always be the same, given the same arguments.
Simplex noise is closely related to Perlin noise. It is widely used for procedural content generation.
There are many webpages which discuss Perlin and Simplex noise in detail.
@param x — The number used to generate the noise value.
@return value — The noise value in the range of 1.
random
function love.math.random()
-> number: number
Generates a pseudo-random number in a platform independent manner. The default love.run seeds this function at startup, so you generally don't need to seed it yourself.
@return number — The pseudo-random number.
randomNormal
function love.math.randomNormal(stddev?: number, mean?: number)
-> number: number
Get a normally distributed pseudo random number.
@param stddev — Standard deviation of the distribution.
@param mean — The mean of the distribution.
@return number — Normally distributed random number with variance (stddev)² and the specified mean.
setRandomSeed
function love.math.setRandomSeed(seed: number)
Sets the seed of the random number generator using the specified integer number. This is called internally at startup, so you generally don't need to call it yourself.
@param seed — The integer number with which you want to seed the randomization. Must be within the range of 2^53 - 1.
setRandomState
function love.math.setRandomState(state: string)
Sets the current state of the random number generator. The value used as an argument for this function is an opaque implementation-dependent string and should only originate from a previous call to love.math.getRandomState.
This is different from love.math.setRandomSeed in that setRandomState directly sets the random number generator's current implementation-dependent state, whereas setRandomSeed gives it a new seed value.
@param state — The new state of the random number generator, represented as a string. This should originate from a previous call to love.math.getRandomState.
triangulate
function love.math.triangulate(polygon: table)
-> triangles: table
Decomposes a simple convex or concave polygon into triangles.
@param polygon — Polygon to triangulate. Must not intersect itself.
@return triangles — List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}.
love.math.colorFromBytes
function love.math.colorFromBytes(rb: number, gb: number, bb: number, ab?: number)
-> r: number
2. g: number
3. b: number
4. a: number
love.math.colorToBytes
function love.math.colorToBytes(r: number, g: number, b: number, a?: number)
-> rb: number
2. gb: number
3. bb: number
4. ab: number
love.math.gammaToLinear
function love.math.gammaToLinear(r: number, g: number, b: number)
-> lr: number
2. lg: number
3. lb: number
love.math.getRandomSeed
function love.math.getRandomSeed()
-> low: number
2. high: number
love.math.getRandomState
function love.math.getRandomState()
-> state: string
love.math.isConvex
function love.math.isConvex(vertices: table)
-> convex: boolean
love.math.linearToGamma
function love.math.linearToGamma(lr: number, lg: number, lb: number)
-> cr: number
2. cg: number
3. cb: number
love.math.newBezierCurve
function love.math.newBezierCurve(vertices: table)
-> curve: love.BezierCurve
love.math.newRandomGenerator
function love.math.newRandomGenerator()
-> rng: love.RandomGenerator
love.math.newTransform
function love.math.newTransform()
-> transform: love.Transform
love.math.noise
function love.math.noise(x: number)
-> value: number
love.math.random
function love.math.random()
-> number: number
love.math.randomNormal
function love.math.randomNormal(stddev?: number, mean?: number)
-> number: number
love.math.setRandomSeed
function love.math.setRandomSeed(seed: number)
love.math.setRandomState
function love.math.setRandomState(state: string)
love.math.triangulate
function love.math.triangulate(polygon: table)
-> triangles: table
love.mouse
getCursor
function love.mouse.getCursor()
-> cursor: love.Cursor
Gets the current Cursor.
@return cursor — The current cursor, or nil if no cursor is set.
getPosition
function love.mouse.getPosition()
-> x: number
2. y: number
Returns the current position of the mouse.
@return x — The position of the mouse along the x-axis.
@return y — The position of the mouse along the y-axis.
getRelativeMode
function love.mouse.getRelativeMode()
-> enabled: boolean
Gets whether relative mode is enabled for the mouse.
If relative mode is enabled, the cursor is hidden and doesn't move when the mouse does, but relative mouse motion events are still generated via love.mousemoved. This lets the mouse move in any direction indefinitely without the cursor getting stuck at the edges of the screen.
The reported position of the mouse is not updated while relative mode is enabled, even when relative mouse motion events are generated.
@return enabled — True if relative mode is enabled, false if it's disabled.
getSystemCursor
function love.mouse.getSystemCursor(ctype: "arrow"|"crosshair"|"hand"|"ibeam"|"image"...(+8))
-> cursor: love.Cursor
Gets a Cursor object representing a system-native hardware cursor.
Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates.
@param ctype — The type of system cursor to get.
@return cursor — The Cursor object representing the system cursor type.
--
-- Types of hardware cursors.
--
--
-- [Open in Browser](https://love2d.org/wiki/CursorType)
--
ctype:
| "image" -- The cursor is using a custom image.
| "arrow" -- An arrow pointer.
| "ibeam" -- An I-beam, normally used when mousing over editable or selectable text.
| "wait" -- Wait graphic.
| "waitarrow" -- Small wait cursor with an arrow pointer.
| "crosshair" -- Crosshair symbol.
| "sizenwse" -- Double arrow pointing to the top-left and bottom-right.
| "sizenesw" -- Double arrow pointing to the top-right and bottom-left.
| "sizewe" -- Double arrow pointing left and right.
| "sizens" -- Double arrow pointing up and down.
| "sizeall" -- Four-pointed arrow pointing up, down, left, and right.
| "no" -- Slashed circle or crossbones.
| "hand" -- Hand symbol.
getX
function love.mouse.getX()
-> x: number
Returns the current x-position of the mouse.
@return x — The position of the mouse along the x-axis.
getY
function love.mouse.getY()
-> y: number
Returns the current y-position of the mouse.
@return y — The position of the mouse along the y-axis.
isCursorSupported
function love.mouse.isCursorSupported()
-> supported: boolean
Gets whether cursor functionality is supported.
If it isn't supported, calling love.mouse.newCursor and love.mouse.getSystemCursor will cause an error. Mobile devices do not support cursors.
@return supported — Whether the system has cursor functionality.
isDown
function love.mouse.isDown(button: number, ...number)
-> down: boolean
Checks whether a certain mouse button is down.
This function does not detect mouse wheel scrolling; you must use the love.wheelmoved (or love.mousepressed in version 0.9.2 and older) callback for that.
@param button — The index of a button to check. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependant.
@return down — True if any specified button is down.
isGrabbed
function love.mouse.isGrabbed()
-> grabbed: boolean
Checks if the mouse is grabbed.
@return grabbed — True if the cursor is grabbed, false if it is not.
isVisible
function love.mouse.isVisible()
-> visible: boolean
Checks if the cursor is visible.
@return visible — True if the cursor to visible, false if the cursor is hidden.
newCursor
function love.mouse.newCursor(imageData: love.ImageData, hotx?: number, hoty?: number)
-> cursor: love.Cursor
Creates a new hardware Cursor object from an image file or ImageData.
Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates.
The hot spot is the point the operating system uses to determine what was clicked and at what position the mouse cursor is. For example, the normal arrow pointer normally has its hot spot at the top left of the image, but a crosshair cursor might have it in the middle.
@param imageData — The ImageData to use for the new Cursor.
@param hotx — The x-coordinate in the ImageData of the cursor's hot spot.
@param hoty — The y-coordinate in the ImageData of the cursor's hot spot.
@return cursor — The new Cursor object.
setCursor
function love.mouse.setCursor(cursor: love.Cursor)
Sets the current mouse cursor.
@param cursor — The Cursor object to use as the current mouse cursor.
setGrabbed
function love.mouse.setGrabbed(grab: boolean)
Grabs the mouse and confines it to the window.
@param grab — True to confine the mouse, false to let it leave the window.
setPosition
function love.mouse.setPosition(x: number, y: number)
Sets the current position of the mouse. Non-integer values are floored.
@param x — The new position of the mouse along the x-axis.
@param y — The new position of the mouse along the y-axis.
setRelativeMode
function love.mouse.setRelativeMode(enable: boolean)
Sets whether relative mode is enabled for the mouse.
When relative mode is enabled, the cursor is hidden and doesn't move when the mouse does, but relative mouse motion events are still generated via love.mousemoved. This lets the mouse move in any direction indefinitely without the cursor getting stuck at the edges of the screen.
The reported position of the mouse may not be updated while relative mode is enabled, even when relative mouse motion events are generated.
@param enable — True to enable relative mode, false to disable it.
setVisible
function love.mouse.setVisible(visible: boolean)
Sets the current visibility of the cursor.
@param visible — True to set the cursor to visible, false to hide the cursor.
setX
function love.mouse.setX(x: number)
Sets the current X position of the mouse.
Non-integer values are floored.
@param x — The new position of the mouse along the x-axis.
setY
function love.mouse.setY(y: number)
Sets the current Y position of the mouse.
Non-integer values are floored.
@param y — The new position of the mouse along the y-axis.
love.mouse
love.mouse
love.mouse.getCursor
function love.mouse.getCursor()
-> cursor: love.Cursor
love.mouse.getPosition
function love.mouse.getPosition()
-> x: number
2. y: number
love.mouse.getRelativeMode
function love.mouse.getRelativeMode()
-> enabled: boolean
love.mouse.getSystemCursor
function love.mouse.getSystemCursor(ctype: "arrow"|"crosshair"|"hand"|"ibeam"|"image"...(+8))
-> cursor: love.Cursor
love.mouse.getX
function love.mouse.getX()
-> x: number
love.mouse.getY
function love.mouse.getY()
-> y: number
love.mouse.isCursorSupported
function love.mouse.isCursorSupported()
-> supported: boolean
love.mouse.isDown
function love.mouse.isDown(button: number, ...number)
-> down: boolean
love.mouse.isGrabbed
function love.mouse.isGrabbed()
-> grabbed: boolean
love.mouse.isVisible
function love.mouse.isVisible()
-> visible: boolean
love.mouse.newCursor
function love.mouse.newCursor(imageData: love.ImageData, hotx?: number, hoty?: number)
-> cursor: love.Cursor
love.mouse.setCursor
function love.mouse.setCursor(cursor: love.Cursor)
love.mouse.setGrabbed
function love.mouse.setGrabbed(grab: boolean)
love.mouse.setPosition
function love.mouse.setPosition(x: number, y: number)
love.mouse.setRelativeMode
function love.mouse.setRelativeMode(enable: boolean)
love.mouse.setVisible
function love.mouse.setVisible(visible: boolean)
love.mouse.setX
function love.mouse.setX(x: number)
love.mouse.setY
function love.mouse.setY(y: number)
love.mousefocus
love.mousemoved
love.mousepressed
love.mousereleased
love.physics
love.physics
love.physics
getDistance
function love.physics.getDistance(fixture1: love.Fixture, fixture2: love.Fixture)
-> distance: number
2. x1: number
3. y1: number
4. x2: number
5. y2: number
Returns the two closest points between two fixtures and their distance.
@param fixture1 — The first fixture.
@param fixture2 — The second fixture.
@return distance — The distance of the two points.
@return x1 — The x-coordinate of the first point.
@return y1 — The y-coordinate of the first point.
@return x2 — The x-coordinate of the second point.
@return y2 — The y-coordinate of the second point.
getMeter
function love.physics.getMeter()
-> scale: number
Returns the meter scale factor.
All coordinates in the physics module are divided by this number, creating a convenient way to draw the objects directly to the screen without the need for graphics transformations.
It is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters.
@return scale — The scale factor as an integer.
newBody
function love.physics.newBody(world: love.World, x?: number, y?: number, type?: "dynamic"|"kinematic"|"static")
-> body: love.Body
Creates a new body.
There are three types of bodies.
-
Static bodies do not move, have a infinite mass, and can be used for level boundaries.
-
Dynamic bodies are the main actors in the simulation, they collide with everything.
-
Kinematic bodies do not react to forces and only collide with dynamic bodies.
The mass of the body gets calculated when a Fixture is attached or removed, but can be changed at any time with Body:setMass or Body:resetMassData.
@param world — The world to create the body in.
@param x — The x position of the body.
@param y — The y position of the body.
@param type — The type of the body.
@return body — A new body.
--
-- The types of a Body.
--
--
-- [Open in Browser](https://love2d.org/wiki/BodyType)
--
type:
| "static" -- Static bodies do not move.
| "dynamic" -- Dynamic bodies collide with all bodies.
| "kinematic" -- Kinematic bodies only collide with dynamic bodies.
newChainShape
function love.physics.newChainShape(loop: boolean, x1: number, y1: number, x2: number, y2: number, ...number)
-> shape: love.ChainShape
Creates a new ChainShape.
@param loop — If the chain should loop back to the first point.
@param x1 — The x position of the first point.
@param y1 — The y position of the first point.
@param x2 — The x position of the second point.
@param y2 — The y position of the second point.
@return shape — The new shape.
newCircleShape
function love.physics.newCircleShape(radius: number)
-> shape: love.CircleShape
Creates a new CircleShape.
@param radius — The radius of the circle.
@return shape — The new shape.
newDistanceJoint
function love.physics.newDistanceJoint(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, collideConnected?: boolean)
-> joint: love.DistanceJoint
Creates a DistanceJoint between two bodies.
This joint constrains the distance between two points on two bodies to be constant. These two points are specified in world coordinates and the two bodies are assumed to be in place when this joint is created. The first anchor point is connected to the first body and the second to the second body, and the points define the length of the distance joint.
@param body1 — The first body to attach to the joint.
@param body2 — The second body to attach to the joint.
@param x1 — The x position of the first anchor point (world space).
@param y1 — The y position of the first anchor point (world space).
@param x2 — The x position of the second anchor point (world space).
@param y2 — The y position of the second anchor point (world space).
@param collideConnected — Specifies whether the two bodies should collide with each other.
@return joint — The new distance joint.
newEdgeShape
function love.physics.newEdgeShape(x1: number, y1: number, x2: number, y2: number)
-> shape: love.EdgeShape
Creates a new EdgeShape.
@param x1 — The x position of the first point.
@param y1 — The y position of the first point.
@param x2 — The x position of the second point.
@param y2 — The y position of the second point.
@return shape — The new shape.
newFixture
function love.physics.newFixture(body: love.Body, shape: love.Shape, density?: number)
-> fixture: love.Fixture
Creates and attaches a Fixture to a body.
Note that the Shape object is copied rather than kept as a reference when the Fixture is created. To get the Shape object that the Fixture owns, use Fixture:getShape.
@param body — The body which gets the fixture attached.
@param shape — The shape to be copied to the fixture.
@param density — The density of the fixture.
@return fixture — The new fixture.
newFrictionJoint
function love.physics.newFrictionJoint(body1: love.Body, body2: love.Body, x: number, y: number, collideConnected?: boolean)
-> joint: love.FrictionJoint
Create a friction joint between two bodies. A FrictionJoint applies friction to a body.
@param body1 — The first body to attach to the joint.
@param body2 — The second body to attach to the joint.
@param x — The x position of the anchor point.
@param y — The y position of the anchor point.
@param collideConnected — Specifies whether the two bodies should collide with each other.
@return joint — The new FrictionJoint.
newGearJoint
function love.physics.newGearJoint(joint1: love.Joint, joint2: love.Joint, ratio?: number, collideConnected?: boolean)
-> joint: love.GearJoint
Create a GearJoint connecting two Joints.
The gear joint connects two joints that must be either prismatic or revolute joints. Using this joint requires that the joints it uses connect their respective bodies to the ground and have the ground as the first body. When destroying the bodies and joints you must make sure you destroy the gear joint before the other joints.
The gear joint has a ratio the determines how the angular or distance values of the connected joints relate to each other. The formula coordinate1 + ratio * coordinate2 always has a constant value that is set when the gear joint is created.
@param joint1 — The first joint to connect with a gear joint.
@param joint2 — The second joint to connect with a gear joint.
@param ratio — The gear ratio.
@param collideConnected — Specifies whether the two bodies should collide with each other.
@return joint — The new gear joint.
newMotorJoint
function love.physics.newMotorJoint(body1: love.Body, body2: love.Body, correctionFactor?: number)
-> joint: love.MotorJoint
Creates a joint between two bodies which controls the relative motion between them.
Position and rotation offsets can be specified once the MotorJoint has been created, as well as the maximum motor force and torque that will be be applied to reach the target offsets.
@param body1 — The first body to attach to the joint.
@param body2 — The second body to attach to the joint.
@param correctionFactor — The joint's initial position correction factor, in the range of 1.
@return joint — The new MotorJoint.
newMouseJoint
function love.physics.newMouseJoint(body: love.Body, x: number, y: number)
-> joint: love.MouseJoint
Create a joint between a body and the mouse.
This joint actually connects the body to a fixed point in the world. To make it follow the mouse, the fixed point must be updated every timestep (example below).
The advantage of using a MouseJoint instead of just changing a body position directly is that collisions and reactions to other joints are handled by the physics engine.
@param body — The body to attach to the mouse.
@param x — The x position of the connecting point.
@param y — The y position of the connecting point.
@return joint — The new mouse joint.
newPolygonShape
function love.physics.newPolygonShape(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, ...number)
-> shape: love.PolygonShape
Creates a new PolygonShape.
This shape can have 8 vertices at most, and must form a convex shape.
@param x1 — The x position of the first point.
@param y1 — The y position of the first point.
@param x2 — The x position of the second point.
@param y2 — The y position of the second point.
@param x3 — The x position of the third point.
@param y3 — The y position of the third point.
@return shape — A new PolygonShape.
newPrismaticJoint
function love.physics.newPrismaticJoint(body1: love.Body, body2: love.Body, x: number, y: number, ax: number, ay: number, collideConnected?: boolean)
-> joint: love.PrismaticJoint
Creates a PrismaticJoint between two bodies.
A prismatic joint constrains two bodies to move relatively to each other on a specified axis. It does not allow for relative rotation. Its definition and operation are similar to a revolute joint, but with translation and force substituted for angle and torque.
@param body1 — The first body to connect with a prismatic joint.
@param body2 — The second body to connect with a prismatic joint.
@param x — The x coordinate of the anchor point.
@param y — The y coordinate of the anchor point.
@param ax — The x coordinate of the axis vector.
@param ay — The y coordinate of the axis vector.
@param collideConnected — Specifies whether the two bodies should collide with each other.
@return joint — The new prismatic joint.
newPulleyJoint
function love.physics.newPulleyJoint(body1: love.Body, body2: love.Body, gx1: number, gy1: number, gx2: number, gy2: number, x1: number, y1: number, x2: number, y2: number, ratio?: number, collideConnected?: boolean)
-> joint: love.PulleyJoint
Creates a PulleyJoint to join two bodies to each other and the ground.
The pulley joint simulates a pulley with an optional block and tackle. If the ratio parameter has a value different from one, then the simulated rope extends faster on one side than the other. In a pulley joint the total length of the simulated rope is the constant length1 + ratio * length2, which is set when the pulley joint is created.
Pulley joints can behave unpredictably if one side is fully extended. It is recommended that the method setMaxLengths be used to constrain the maximum lengths each side can attain.
@param body1 — The first body to connect with a pulley joint.
@param body2 — The second body to connect with a pulley joint.
@param gx1 — The x coordinate of the first body's ground anchor.
@param gy1 — The y coordinate of the first body's ground anchor.
@param gx2 — The x coordinate of the second body's ground anchor.
@param gy2 — The y coordinate of the second body's ground anchor.
@param x1 — The x coordinate of the pulley joint anchor in the first body.
@param y1 — The y coordinate of the pulley joint anchor in the first body.
@param x2 — The x coordinate of the pulley joint anchor in the second body.
@param y2 — The y coordinate of the pulley joint anchor in the second body.
@param ratio — The joint ratio.
@param collideConnected — Specifies whether the two bodies should collide with each other.
@return joint — The new pulley joint.
newRectangleShape
function love.physics.newRectangleShape(width: number, height: number)
-> shape: love.PolygonShape
Shorthand for creating rectangular PolygonShapes.
By default, the local origin is located at the '''center''' of the rectangle as opposed to the top left for graphics.
@param width — The width of the rectangle.
@param height — The height of the rectangle.
@return shape — A new PolygonShape.
newRevoluteJoint
function love.physics.newRevoluteJoint(body1: love.Body, body2: love.Body, x: number, y: number, collideConnected?: boolean)
-> joint: love.RevoluteJoint
Creates a pivot joint between two bodies.
This joint connects two bodies to a point around which they can pivot.
@param body1 — The first body.
@param body2 — The second body.
@param x — The x position of the connecting point.
@param y — The y position of the connecting point.
@param collideConnected — Specifies whether the two bodies should collide with each other.
@return joint — The new revolute joint.
newRopeJoint
function love.physics.newRopeJoint(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, maxLength: number, collideConnected?: boolean)
-> joint: love.RopeJoint
Creates a joint between two bodies. Its only function is enforcing a max distance between these bodies.
@param body1 — The first body to attach to the joint.
@param body2 — The second body to attach to the joint.
@param x1 — The x position of the first anchor point.
@param y1 — The y position of the first anchor point.
@param x2 — The x position of the second anchor point.
@param y2 — The y position of the second anchor point.
@param maxLength — The maximum distance for the bodies.
@param collideConnected — Specifies whether the two bodies should collide with each other.
@return joint — The new RopeJoint.
newWeldJoint
function love.physics.newWeldJoint(body1: love.Body, body2: love.Body, x: number, y: number, collideConnected?: boolean)
-> joint: love.WeldJoint
Creates a constraint joint between two bodies. A WeldJoint essentially glues two bodies together. The constraint is a bit soft, however, due to Box2D's iterative solver.
@param body1 — The first body to attach to the joint.
@param body2 — The second body to attach to the joint.
@param x — The x position of the anchor point (world space).
@param y — The y position of the anchor point (world space).
@param collideConnected — Specifies whether the two bodies should collide with each other.
@return joint — The new WeldJoint.
newWheelJoint
function love.physics.newWheelJoint(body1: love.Body, body2: love.Body, x: number, y: number, ax: number, ay: number, collideConnected?: boolean)
-> joint: love.WheelJoint
Creates a wheel joint.
@param body1 — The first body.
@param body2 — The second body.
@param x — The x position of the anchor point.
@param y — The y position of the anchor point.
@param ax — The x position of the axis unit vector.
@param ay — The y position of the axis unit vector.
@param collideConnected — Specifies whether the two bodies should collide with each other.
@return joint — The new WheelJoint.
newWorld
function love.physics.newWorld(xg?: number, yg?: number, sleep?: boolean)
-> world: love.World
Creates a new World.
@param xg — The x component of gravity.
@param yg — The y component of gravity.
@param sleep — Whether the bodies in this world are allowed to sleep.
@return world — A brave new World.
setMeter
function love.physics.setMeter(scale: number)
Sets the pixels to meter scale factor.
All coordinates in the physics module are divided by this number and converted to meters, and it creates a convenient way to draw the objects directly to the screen without the need for graphics transformations.
It is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters. The default meter scale is 30.
@param scale — The scale factor as an integer.
love.physics.getDistance
function love.physics.getDistance(fixture1: love.Fixture, fixture2: love.Fixture)
-> distance: number
2. x1: number
3. y1: number
4. x2: number
5. y2: number
love.physics.getMeter
function love.physics.getMeter()
-> scale: number
love.physics.newBody
function love.physics.newBody(world: love.World, x?: number, y?: number, type?: "dynamic"|"kinematic"|"static")
-> body: love.Body
love.physics.newChainShape
function love.physics.newChainShape(loop: boolean, x1: number, y1: number, x2: number, y2: number, ...number)
-> shape: love.ChainShape
love.physics.newCircleShape
function love.physics.newCircleShape(radius: number)
-> shape: love.CircleShape
love.physics.newDistanceJoint
function love.physics.newDistanceJoint(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, collideConnected?: boolean)
-> joint: love.DistanceJoint
love.physics.newEdgeShape
function love.physics.newEdgeShape(x1: number, y1: number, x2: number, y2: number)
-> shape: love.EdgeShape
love.physics.newFixture
function love.physics.newFixture(body: love.Body, shape: love.Shape, density?: number)
-> fixture: love.Fixture
love.physics.newFrictionJoint
function love.physics.newFrictionJoint(body1: love.Body, body2: love.Body, x: number, y: number, collideConnected?: boolean)
-> joint: love.FrictionJoint
love.physics.newGearJoint
function love.physics.newGearJoint(joint1: love.Joint, joint2: love.Joint, ratio?: number, collideConnected?: boolean)
-> joint: love.GearJoint
love.physics.newMotorJoint
function love.physics.newMotorJoint(body1: love.Body, body2: love.Body, correctionFactor?: number)
-> joint: love.MotorJoint
love.physics.newMouseJoint
function love.physics.newMouseJoint(body: love.Body, x: number, y: number)
-> joint: love.MouseJoint
love.physics.newPolygonShape
function love.physics.newPolygonShape(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, ...number)
-> shape: love.PolygonShape
love.physics.newPrismaticJoint
function love.physics.newPrismaticJoint(body1: love.Body, body2: love.Body, x: number, y: number, ax: number, ay: number, collideConnected?: boolean)
-> joint: love.PrismaticJoint
love.physics.newPulleyJoint
function love.physics.newPulleyJoint(body1: love.Body, body2: love.Body, gx1: number, gy1: number, gx2: number, gy2: number, x1: number, y1: number, x2: number, y2: number, ratio?: number, collideConnected?: boolean)
-> joint: love.PulleyJoint
love.physics.newRectangleShape
function love.physics.newRectangleShape(width: number, height: number)
-> shape: love.PolygonShape
love.physics.newRevoluteJoint
function love.physics.newRevoluteJoint(body1: love.Body, body2: love.Body, x: number, y: number, collideConnected?: boolean)
-> joint: love.RevoluteJoint
love.physics.newRopeJoint
function love.physics.newRopeJoint(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, maxLength: number, collideConnected?: boolean)
-> joint: love.RopeJoint
love.physics.newWeldJoint
function love.physics.newWeldJoint(body1: love.Body, body2: love.Body, x: number, y: number, collideConnected?: boolean)
-> joint: love.WeldJoint
love.physics.newWheelJoint
function love.physics.newWheelJoint(body1: love.Body, body2: love.Body, x: number, y: number, ax: number, ay: number, collideConnected?: boolean)
-> joint: love.WheelJoint
love.physics.newWorld
function love.physics.newWorld(xg?: number, yg?: number, sleep?: boolean)
-> world: love.World
love.physics.setMeter
function love.physics.setMeter(scale: number)
love.quit
love.resize
love.run
love.setDeprecationOutput
function love.setDeprecationOutput(enable: boolean)
love.sound
love.sound
love.sound
newDecoder
function love.sound.newDecoder(file: love.File, buffer?: number)
-> decoder: love.Decoder
Attempts to find a decoder for the encoded sound data in the specified file.
@param file — The file with encoded sound data.
@param buffer — The size of each decoded chunk, in bytes.
@return decoder — A new Decoder object.
newSoundData
function love.sound.newSoundData(filename: string)
-> soundData: love.SoundData
Creates new SoundData from a filepath, File, or Decoder. It's also possible to create SoundData with a custom sample rate, channel and bit depth.
The sound data will be decoded to the memory in a raw format. It is recommended to create only short sounds like effects, as a 3 minute song uses 30 MB of memory this way.
@param filename — The file name of the file to load.
@return soundData — A new SoundData object.
love.sound.newDecoder
function love.sound.newDecoder(file: love.File, buffer?: number)
-> decoder: love.Decoder
love.sound.newSoundData
function love.sound.newSoundData(filename: string)
-> soundData: love.SoundData
love.system
love.system
love.system
getClipboardText
function love.system.getClipboardText()
-> text: string
Gets text from the clipboard.
@return text — The text currently held in the system's clipboard.
getOS
function love.system.getOS()
-> osString: string
Gets the current operating system. In general, LÖVE abstracts away the need to know the current operating system, but there are a few cases where it can be useful (especially in combination with os.execute.)
@return osString — The current operating system. 'OS X', 'Windows', 'Linux', 'Android' or 'iOS'.
getPowerInfo
function love.system.getPowerInfo()
-> state: "battery"|"charged"|"charging"|"nobattery"|"unknown"
2. percent: number
3. seconds: number
Gets information about the system's power supply.
@return state — The basic state of the power supply.
@return percent — Percentage of battery life left, between 0 and 100. nil if the value can't be determined or there's no battery.
@return seconds — Seconds of battery life left. nil if the value can't be determined or there's no battery.
--
-- The basic state of the system's power supply.
--
--
-- [Open in Browser](https://love2d.org/wiki/PowerState)
--
state:
| "unknown" -- Cannot determine power status.
| "battery" -- Not plugged in, running on a battery.
| "nobattery" -- Plugged in, no battery available.
| "charging" -- Plugged in, charging battery.
| "charged" -- Plugged in, battery is fully charged.
getProcessorCount
function love.system.getProcessorCount()
-> processorCount: number
Gets the amount of logical processor in the system.
@return processorCount — Amount of logical processors.
hasBackgroundMusic
function love.system.hasBackgroundMusic()
-> backgroundmusic: boolean
Gets whether another application on the system is playing music in the background.
Currently this is implemented on iOS and Android, and will always return false on other operating systems. The t.audio.mixwithsystem flag in love.conf can be used to configure whether background audio / music from other apps should play while LÖVE is open.
@return backgroundmusic — True if the user is playing music in the background via another app, false otherwise.
openURL
function love.system.openURL(url: string)
-> success: boolean
Opens a URL with the user's web or file browser.
@param url — The URL to open. Must be formatted as a proper URL.
@return success — Whether the URL was opened successfully.
setClipboardText
function love.system.setClipboardText(text: string)
Puts text in the clipboard.
@param text — The new text to hold in the system's clipboard.
vibrate
function love.system.vibrate(seconds?: number)
Causes the device to vibrate, if possible. Currently this will only work on Android and iOS devices that have a built-in vibration motor.
@param seconds — The duration to vibrate for. If called on an iOS device, it will always vibrate for 0.5 seconds due to limitations in the iOS system APIs.
love.system.getClipboardText
function love.system.getClipboardText()
-> text: string
love.system.getOS
function love.system.getOS()
-> osString: string
love.system.getPowerInfo
function love.system.getPowerInfo()
-> state: "battery"|"charged"|"charging"|"nobattery"|"unknown"
2. percent: number
3. seconds: number
love.system.getProcessorCount
function love.system.getProcessorCount()
-> processorCount: number
love.system.hasBackgroundMusic
function love.system.hasBackgroundMusic()
-> backgroundmusic: boolean
love.system.openURL
function love.system.openURL(url: string)
-> success: boolean
love.system.setClipboardText
function love.system.setClipboardText(text: string)
love.system.vibrate
function love.system.vibrate(seconds?: number)
love.textedited
love.textinput
love.thread
getChannel
function love.thread.getChannel(name: string)
-> channel: love.Channel
Creates or retrieves a named thread channel.
@param name — The name of the channel you want to create or retrieve.
@return channel — The Channel object associated with the name.
newChannel
function love.thread.newChannel()
-> channel: love.Channel
Create a new unnamed thread channel.
One use for them is to pass new unnamed channels to other threads via Channel:push on a named channel.
@return channel — The new Channel object.
newThread
function love.thread.newThread(filename: string)
-> thread: love.Thread
Creates a new Thread from a filename, string or FileData object containing Lua code.
@param filename — The name of the Lua file to use as the source.
@return thread — A new Thread that has yet to be started.
love.thread
love.thread
love.thread.getChannel
function love.thread.getChannel(name: string)
-> channel: love.Channel
love.thread.newChannel
function love.thread.newChannel()
-> channel: love.Channel
love.thread.newThread
function love.thread.newThread(filename: string)
-> thread: love.Thread
love.threaderror
love.timer
love.timer
love.timer
getAverageDelta
function love.timer.getAverageDelta()
-> delta: number
Returns the average delta time (seconds per frame) over the last second.
@return delta — The average delta time over the last second.
getDelta
function love.timer.getDelta()
-> dt: number
Returns the time between the last two frames.
@return dt — The time passed (in seconds).
getFPS
function love.timer.getFPS()
-> fps: number
Returns the current frames per second.
@return fps — The current FPS.
getTime
function love.timer.getTime()
-> time: number
Returns the value of a timer with an unspecified starting time.
This function should only be used to calculate differences between points in time, as the starting time of the timer is unknown.
@return time — The time in seconds. Given as a decimal, accurate to the microsecond.
sleep
function love.timer.sleep(s: number)
Pauses the current thread for the specified amount of time.
@param s — Seconds to sleep for.
step
function love.timer.step()
-> dt: number
Measures the time between two frames.
Calling this changes the return value of love.timer.getDelta.
@return dt — The time passed (in seconds).
love.timer.getAverageDelta
function love.timer.getAverageDelta()
-> delta: number
love.timer.getDelta
function love.timer.getDelta()
-> dt: number
love.timer.getFPS
function love.timer.getFPS()
-> fps: number
love.timer.getTime
function love.timer.getTime()
-> time: number
love.timer.sleep
function love.timer.sleep(s: number)
love.timer.step
function love.timer.step()
-> dt: number
love.touch
getPosition
function love.touch.getPosition(id: lightuserdata)
-> x: number
2. y: number
Gets the current position of the specified touch-press, in pixels.
@param id — The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values.
@return x — The position along the x-axis of the touch-press inside the window, in pixels.
@return y — The position along the y-axis of the touch-press inside the window, in pixels.
getPressure
function love.touch.getPressure(id: lightuserdata)
-> pressure: number
Gets the current pressure of the specified touch-press.
@param id — The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values.
@return pressure — The pressure of the touch-press. Most touch screens aren't pressure sensitive, in which case the pressure will be 1.
getTouches
function love.touch.getTouches()
-> touches: table
Gets a list of all active touch-presses.
@return touches — A list of active touch-press id values, which can be used with love.touch.getPosition.
love.touch
love.touch
love.touch.getPosition
function love.touch.getPosition(id: lightuserdata)
-> x: number
2. y: number
love.touch.getPressure
function love.touch.getPressure(id: lightuserdata)
-> pressure: number
love.touch.getTouches
function love.touch.getTouches()
-> touches: table
love.touchmoved
love.touchpressed
love.touchreleased
love.update
love.video
newVideoStream
function love.video.newVideoStream(filename: string)
-> videostream: love.VideoStream
Creates a new VideoStream. Currently only Ogg Theora video files are supported. VideoStreams can't draw videos, see love.graphics.newVideo for that.
@param filename — The file path to the Ogg Theora video file.
@return videostream — A new VideoStream.
love.video
love.video
love.video.newVideoStream
function love.video.newVideoStream(filename: string)
-> videostream: love.VideoStream
love.visible
love.wheelmoved
love.window
love.window
love.window
close
function love.window.close()
Closes the window. It can be reopened with love.window.setMode.
fromPixels
function love.window.fromPixels(pixelvalue: number)
-> value: number
Converts a number from pixels to density-independent units.
The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.fromPixels(1600) would return 800 in that case.
This function converts coordinates from pixels to the size users are expecting them to display at onscreen. love.window.toPixels does the opposite. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled.
Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units.
@param pixelvalue — A number in pixels to convert to density-independent units.
@return value — The converted number, in density-independent units.
getDPIScale
function love.window.getDPIScale()
-> scale: number
Gets the DPI scale factor associated with the window.
The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.getDPIScale() would return 2.0 in that case.
The love.window.fromPixels and love.window.toPixels functions can also be used to convert between units.
The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled.
@return scale — The pixel scale factor associated with the window.
getDesktopDimensions
function love.window.getDesktopDimensions(displayindex?: number)
-> width: number
2. height: number
Gets the width and height of the desktop.
@param displayindex — The index of the display, if multiple monitors are available.
@return width — The width of the desktop.
@return height — The height of the desktop.
getDisplayCount
function love.window.getDisplayCount()
-> count: number
Gets the number of connected monitors.
@return count — The number of currently connected displays.
getDisplayName
function love.window.getDisplayName(displayindex?: number)
-> name: string
Gets the name of a display.
@param displayindex — The index of the display to get the name of.
@return name — The name of the specified display.
getDisplayOrientation
function love.window.getDisplayOrientation(displayindex?: number)
-> orientation: "landscape"|"landscapeflipped"|"portrait"|"portraitflipped"|"unknown"
Gets current device display orientation.
@param displayindex — Display index to get its display orientation, or nil for default display index.
@return orientation — Current device display orientation.
--
-- Types of device display orientation.
--
--
-- [Open in Browser](https://love2d.org/wiki/DisplayOrientation)
--
orientation:
| "unknown" -- Orientation cannot be determined.
| "landscape" -- Landscape orientation.
| "landscapeflipped" -- Landscape orientation (flipped).
| "portrait" -- Portrait orientation.
| "portraitflipped" -- Portrait orientation (flipped).
getFullscreen
function love.window.getFullscreen()
-> fullscreen: boolean
2. fstype: "desktop"|"exclusive"|"normal"
Gets whether the window is fullscreen.
@return fullscreen — True if the window is fullscreen, false otherwise.
@return fstype — The type of fullscreen mode used.
--
-- Types of fullscreen modes.
--
--
-- [Open in Browser](https://love2d.org/wiki/FullscreenType)
--
fstype:
| "desktop" -- Sometimes known as borderless fullscreen windowed mode. A borderless screen-sized window is created which sits on top of all desktop UI elements. The window is automatically resized to match the dimensions of the desktop, and its size cannot be changed.
| "exclusive" -- Standard exclusive-fullscreen mode. Changes the display mode (actual resolution) of the monitor.
| "normal" -- Standard exclusive-fullscreen mode. Changes the display mode (actual resolution) of the monitor.
getFullscreenModes
function love.window.getFullscreenModes(displayindex?: number)
-> modes: table
Gets a list of supported fullscreen modes.
@param displayindex — The index of the display, if multiple monitors are available.
@return modes — A table of width/height pairs. (Note that this may not be in order.)
getIcon
function love.window.getIcon()
-> imagedata: love.ImageData
Gets the window icon.
@return imagedata — The window icon imagedata, or nil if no icon has been set with love.window.setIcon.
getMode
function love.window.getMode()
-> width: number
2. height: number
3. flags: { fullscreen: boolean, fullscreentype: "desktop"|"exclusive"|"normal", vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, refreshrate: number, x: number, y: number, srgb: boolean }
Gets the display mode and properties of the window.
@return width — Window width.
@return height — Window height.
@return flags — Table with the window properties:
getPosition
function love.window.getPosition()
-> x: number
2. y: number
3. displayindex: number
Gets the position of the window on the screen.
The window position is in the coordinate space of the display it is currently in.
@return x — The x-coordinate of the window's position.
@return y — The y-coordinate of the window's position.
@return displayindex — The index of the display that the window is in.
getSafeArea
function love.window.getSafeArea()
-> x: number
2. y: number
3. w: number
4. h: number
Gets area inside the window which is known to be unobstructed by a system title bar, the iPhone X notch, etc. Useful for making sure UI elements can be seen by the user.
@return x — Starting position of safe area (x-axis).
@return y — Starting position of safe area (y-axis).
@return w — Width of safe area.
@return h — Height of safe area.
getTitle
function love.window.getTitle()
-> title: string
Gets the window title.
@return title — The current window title.
getVSync
function love.window.getVSync()
-> vsync: number
Gets current vertical synchronization (vsync).
@return vsync — Current vsync status. 1 if enabled, 0 if disabled, and -1 for adaptive vsync.
hasFocus
function love.window.hasFocus()
-> focus: boolean
Checks if the game window has keyboard focus.
@return focus — True if the window has the focus or false if not.
hasMouseFocus
function love.window.hasMouseFocus()
-> focus: boolean
Checks if the game window has mouse focus.
@return focus — True if the window has mouse focus or false if not.
isDisplaySleepEnabled
function love.window.isDisplaySleepEnabled()
-> enabled: boolean
Gets whether the display is allowed to sleep while the program is running.
Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed.
@return enabled — True if system display sleep is enabled / allowed, false otherwise.
isMaximized
function love.window.isMaximized()
-> maximized: boolean
Gets whether the Window is currently maximized.
The window can be maximized if it is not fullscreen and is resizable, and either the user has pressed the window's Maximize button or love.window.maximize has been called.
@return maximized — True if the window is currently maximized in windowed mode, false otherwise.
isMinimized
function love.window.isMinimized()
-> minimized: boolean
Gets whether the Window is currently minimized.
@return minimized — True if the window is currently minimized, false otherwise.
isOpen
function love.window.isOpen()
-> open: boolean
Checks if the window is open.
@return open — True if the window is open, false otherwise.
isVisible
function love.window.isVisible()
-> visible: boolean
Checks if the game window is visible.
The window is considered visible if it's not minimized and the program isn't hidden.
@return visible — True if the window is visible or false if not.
maximize
function love.window.maximize()
Makes the window as large as possible.
This function has no effect if the window isn't resizable, since it essentially programmatically presses the window's 'maximize' button.
minimize
function love.window.minimize()
Minimizes the window to the system's task bar / dock.
requestAttention
function love.window.requestAttention(continuous?: boolean)
Causes the window to request the attention of the user if it is not in the foreground.
In Windows the taskbar icon will flash, and in OS X the dock icon will bounce.
@param continuous — Whether to continuously request attention until the window becomes active, or to do it only once.
restore
function love.window.restore()
Restores the size and position of the window if it was minimized or maximized.
setDisplaySleepEnabled
function love.window.setDisplaySleepEnabled(enable: boolean)
Sets whether the display is allowed to sleep while the program is running.
Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed.
@param enable — True to enable system display sleep, false to disable it.
setFullscreen
function love.window.setFullscreen(fullscreen: boolean)
-> success: boolean
Enters or exits fullscreen. The display to use when entering fullscreen is chosen based on which display the window is currently in, if multiple monitors are connected.
@param fullscreen — Whether to enter or exit fullscreen mode.
@return success — True if an attempt to enter fullscreen was successful, false otherwise.
setIcon
function love.window.setIcon(imagedata: love.ImageData)
-> success: boolean
Sets the window icon until the game is quit. Not all operating systems support very large icon images.
@param imagedata — The window icon image.
@return success — Whether the icon has been set successfully.
setMode
function love.window.setMode(width: number, height: number, flags?: { fullscreen: boolean, fullscreentype: "desktop"|"exclusive"|"normal", vsync: boolean, msaa: number, stencil: boolean, depth: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number, usedpiscale: boolean, srgb: boolean })
-> success: boolean
Sets the display mode and properties of the window.
If width or height is 0, setMode will use the width and height of the desktop.
Changing the display mode may have side effects: for example, canvases will be cleared and values sent to shaders with canvases beforehand or re-draw to them afterward if you need to.
@param width — Display width.
@param height — Display height.
@param flags — The flags table with the options:
@return success — True if successful, false otherwise.
setPosition
function love.window.setPosition(x: number, y: number, displayindex?: number)
Sets the position of the window on the screen.
The window position is in the coordinate space of the specified display.
@param x — The x-coordinate of the window's position.
@param y — The y-coordinate of the window's position.
@param displayindex — The index of the display that the new window position is relative to.
setTitle
function love.window.setTitle(title: string)
Sets the window title.
@param title — The new window title.
setVSync
function love.window.setVSync(vsync: number)
Sets vertical synchronization mode.
@param vsync — VSync number: 1 to enable, 0 to disable, and -1 for adaptive vsync.
showMessageBox
function love.window.showMessageBox(title: string, message: string, type?: "error"|"info"|"warning", attachtowindow?: boolean)
-> success: boolean
Displays a message box dialog above the love window. The message box contains a title, optional text, and buttons.
@param title — The title of the message box.
@param message — The text inside the message box.
@param type — The type of the message box.
@param attachtowindow — Whether the message box should be attached to the love window or free-floating.
@return success — Whether the message box was successfully displayed.
--
-- Types of message box dialogs. Different types may have slightly different looks.
--
--
-- [Open in Browser](https://love2d.org/wiki/MessageBoxType)
--
type:
| "info" -- Informational dialog.
| "warning" -- Warning dialog.
| "error" -- Error dialog.
toPixels
function love.window.toPixels(value: number)
-> pixelvalue: number
Converts a number from density-independent units to pixels.
The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.toPixels(800) would return 1600 in that case.
This is used to convert coordinates from the size users are expecting them to display at onscreen to pixels. love.window.fromPixels does the opposite. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled.
Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units.
@param value — A number in density-independent units to convert to pixels.
@return pixelvalue — The converted number, in pixels.
updateMode
function love.window.updateMode(width: number, height: number, settings: { fullscreen: boolean, fullscreentype: "desktop"|"exclusive"|"normal", vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number })
-> success: boolean
Sets the display mode and properties of the window, without modifying unspecified properties.
If width or height is 0, updateMode will use the width and height of the desktop.
Changing the display mode may have side effects: for example, canvases will be cleared. Make sure to save the contents of canvases beforehand or re-draw to them afterward if you need to.
@param width — Window width.
@param height — Window height.
@param settings — The settings table with the following optional fields. Any field not filled in will use the current value that would be returned by love.window.getMode.
@return success — True if successful, false otherwise.
love.window.close
function love.window.close()
love.window.fromPixels
function love.window.fromPixels(pixelvalue: number)
-> value: number
love.window.getDPIScale
function love.window.getDPIScale()
-> scale: number
love.window.getDesktopDimensions
function love.window.getDesktopDimensions(displayindex?: number)
-> width: number
2. height: number
love.window.getDisplayCount
function love.window.getDisplayCount()
-> count: number
love.window.getDisplayName
function love.window.getDisplayName(displayindex?: number)
-> name: string
love.window.getDisplayOrientation
function love.window.getDisplayOrientation(displayindex?: number)
-> orientation: "landscape"|"landscapeflipped"|"portrait"|"portraitflipped"|"unknown"
love.window.getFullscreen
function love.window.getFullscreen()
-> fullscreen: boolean
2. fstype: "desktop"|"exclusive"|"normal"
love.window.getFullscreenModes
function love.window.getFullscreenModes(displayindex?: number)
-> modes: table
love.window.getIcon
function love.window.getIcon()
-> imagedata: love.ImageData
love.window.getMode
function love.window.getMode()
-> width: number
2. height: number
3. flags: { fullscreen: boolean, fullscreentype: "desktop"|"exclusive"|"normal", vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, refreshrate: number, x: number, y: number, srgb: boolean }
love.window.getPosition
function love.window.getPosition()
-> x: number
2. y: number
3. displayindex: number
love.window.getSafeArea
function love.window.getSafeArea()
-> x: number
2. y: number
3. w: number
4. h: number
love.window.getTitle
function love.window.getTitle()
-> title: string
love.window.getVSync
function love.window.getVSync()
-> vsync: number
love.window.hasFocus
function love.window.hasFocus()
-> focus: boolean
love.window.hasMouseFocus
function love.window.hasMouseFocus()
-> focus: boolean
love.window.isDisplaySleepEnabled
function love.window.isDisplaySleepEnabled()
-> enabled: boolean
love.window.isMaximized
function love.window.isMaximized()
-> maximized: boolean
love.window.isMinimized
function love.window.isMinimized()
-> minimized: boolean
love.window.isOpen
function love.window.isOpen()
-> open: boolean
love.window.isVisible
function love.window.isVisible()
-> visible: boolean
love.window.maximize
function love.window.maximize()
love.window.minimize
function love.window.minimize()
love.window.requestAttention
function love.window.requestAttention(continuous?: boolean)
love.window.restore
function love.window.restore()
love.window.setDisplaySleepEnabled
function love.window.setDisplaySleepEnabled(enable: boolean)
love.window.setFullscreen
function love.window.setFullscreen(fullscreen: boolean)
-> success: boolean
love.window.setIcon
function love.window.setIcon(imagedata: love.ImageData)
-> success: boolean
love.window.setMode
function love.window.setMode(width: number, height: number, flags?: { fullscreen: boolean, fullscreentype: "desktop"|"exclusive"|"normal", vsync: boolean, msaa: number, stencil: boolean, depth: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number, usedpiscale: boolean, srgb: boolean })
-> success: boolean
love.window.setPosition
function love.window.setPosition(x: number, y: number, displayindex?: number)
love.window.setTitle
function love.window.setTitle(title: string)
love.window.setVSync
function love.window.setVSync(vsync: number)
love.window.showMessageBox
function love.window.showMessageBox(title: string, message: string, type?: "error"|"info"|"warning", attachtowindow?: boolean)
-> success: boolean
love.window.toPixels
function love.window.toPixels(value: number)
-> pixelvalue: number
love.window.updateMode
function love.window.updateMode(width: number, height: number, settings: { fullscreen: boolean, fullscreentype: "desktop"|"exclusive"|"normal", vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number })
-> success: boolean
math
mathlib
math.abs
function math.abs(x: <Number:number>)
-> <Number:number>
math.acos
function math.acos(x: number)
-> number
math.asin
function math.asin(x: number)
-> number
math.atan
function math.atan(y: number)
-> number
math.atan2
function math.atan2(y: number, x: number)
-> number
math.ceil
function math.ceil(x: number)
-> integer
math.cos
function math.cos(x: number)
-> number
math.cosh
function math.cosh(x: number)
-> number
math.deg
function math.deg(x: number)
-> number
math.exp
function math.exp(x: number)
-> number
math.floor
function math.floor(x: number)
-> integer
math.fmod
function math.fmod(x: number, y: number)
-> number
math.frexp
function math.frexp(x: number)
-> m: number
2. e: number
math.ldexp
function math.ldexp(m: number, e: number)
-> number
math.log
function math.log(x: number, base?: integer)
-> number
math.log10
function math.log10(x: number)
-> number
math.max
function math.max(x: <Number:number>, ...<Number:number>)
-> <Number:number>
math.min
function math.min(x: <Number:number>, ...<Number:number>)
-> <Number:number>
math.modf
function math.modf(x: number)
-> integer
2. number
math.pow
function math.pow(x: number, y: number)
-> number
math.rad
function math.rad(x: number)
-> number
math.random
function math.random(m: integer, n: integer)
-> integer
math.randomseed
function math.randomseed(x: integer)
math.sin
function math.sin(x: number)
-> number
math.sinh
function math.sinh(x: number)
-> number
math.sqrt
function math.sqrt(x: number)
-> number
math.tan
function math.tan(x: number)
-> number
math.tanh
function math.tanh(x: number)
-> number
math.tointeger
function math.tointeger(x: any)
-> integer?
math.type
function math.type(x: any)
-> "float"|"integer"|'nil'
math.ult
function math.ult(m: integer, n: integer)
-> boolean
mathlib
abs
function math.abs(x: <Number:number>)
-> <Number:number>
Returns the absolute value of x.
acos
function math.acos(x: number)
-> number
Returns the arc cosine of x (in radians).
asin
function math.asin(x: number)
-> number
Returns the arc sine of x (in radians).
atan
function math.atan(y: number)
-> number
Returns the arc tangent of x (in radians).
atan2
function math.atan2(y: number, x: number)
-> number
Returns the arc tangent of y/x (in radians).
ceil
function math.ceil(x: number)
-> integer
Returns the smallest integral value larger than or equal to x.
cos
function math.cos(x: number)
-> number
Returns the cosine of x (assumed to be in radians).
cosh
function math.cosh(x: number)
-> number
Returns the hyperbolic cosine of x (assumed to be in radians).
deg
function math.deg(x: number)
-> number
Converts the angle x from radians to degrees.
exp
function math.exp(x: number)
-> number
Returns the value e^x (where e is the base of natural logarithms).
floor
function math.floor(x: number)
-> integer
Returns the largest integral value smaller than or equal to x.
fmod
function math.fmod(x: number, y: number)
-> number
Returns the remainder of the division of x by y that rounds the quotient towards zero.
frexp
function math.frexp(x: number)
-> m: number
2. e: number
Decompose x into tails and exponents. Returns m and e such that x = m * (2 ^ e), e is an integer and the absolute value of m is in the range [0.5, 1) (or zero when x is zero).
huge
number
A value larger than any other numeric value.
ldexp
function math.ldexp(m: number, e: number)
-> number
Returns m * (2 ^ e) .
log
function math.log(x: number, base?: integer)
-> number
Returns the logarithm of x in the given base.
log10
function math.log10(x: number)
-> number
Returns the base-10 logarithm of x.
max
function math.max(x: <Number:number>, ...<Number:number>)
-> <Number:number>
Returns the argument with the maximum value, according to the Lua operator <.
min
function math.min(x: <Number:number>, ...<Number:number>)
-> <Number:number>
Returns the argument with the minimum value, according to the Lua operator <.
modf
function math.modf(x: number)
-> integer
2. number
Returns the integral part of x and the fractional part of x.
pi
number
The value of π.
pow
function math.pow(x: number, y: number)
-> number
Returns x ^ y .
rad
function math.rad(x: number)
-> number
Converts the angle x from degrees to radians.
random
function math.random(m: integer, n: integer)
-> integer
math.random(): Returns a float in the range [0,1).math.random(n): Returns a integer in the range [1, n].math.random(m, n): Returns a integer in the range [m, n].
randomseed
function math.randomseed(x: integer)
Sets x as the "seed" for the pseudo-random generator.
sin
function math.sin(x: number)
-> number
Returns the sine of x (assumed to be in radians).
sinh
function math.sinh(x: number)
-> number
Returns the hyperbolic sine of x (assumed to be in radians).
sqrt
function math.sqrt(x: number)
-> number
Returns the square root of x.
tan
function math.tan(x: number)
-> number
Returns the tangent of x (assumed to be in radians).
tanh
function math.tanh(x: number)
-> number
Returns the hyperbolic tangent of x (assumed to be in radians).
tointeger
function math.tointeger(x: any)
-> integer?
Miss locale
type
function math.type(x: any)
-> "float"|"integer"|'nil'
Miss locale
return #1:
| "integer"
| "float"
| 'nil'
ult
function math.ult(m: integer, n: integer)
-> boolean
Miss locale
metatable
__add
fun(t1: any, t2: any):any|nil
__call
fun(t: any, ...any):...unknown|nil
__concat
fun(t1: any, t2: any):any|nil
__div
fun(t1: any, t2: any):any|nil
__eq
fun(t1: any, t2: any):boolean|nil
__gc
fun(t: any)|nil
__index
table|fun(t: any, k: any):any|nil
__le
fun(t1: any, t2: any):boolean|nil
__len
fun(t: any):integer|nil
__lt
fun(t1: any, t2: any):boolean|nil
__metatable
any
__mod
fun(t1: any, t2: any):any|nil
__mode
'k'|'kv'|'v'|nil
__mul
fun(t1: any, t2: any):any|nil
__newindex
table|fun(t: any, k: any, v: any)|nil
__pow
fun(t1: any, t2: any):any|nil
__sub
fun(t1: any, t2: any):any|nil
__tostring
fun(t: any):string|nil
__unm
fun(t: any):any|nil
module
function module(name: string, ...any)
newproxy
function newproxy(proxy: boolean|table|userdata)
-> userdata
next
function next(table: table<<K>, <V>>, index?: <K>)
-> <K>?
2. <V>?
nil
number
openmode
os
oslib
os.clock
function os.clock()
-> number
os.date
function os.date(format?: string, time?: integer)
-> string|osdate
os.difftime
function os.difftime(t2: integer, t1: integer)
-> integer
os.execute
function os.execute(command?: string)
-> suc: boolean?
2. exitcode: ("exit"|"signal")?
3. code: integer?
os.exit
function os.exit(code?: boolean|integer, close?: boolean)
os.getenv
function os.getenv(varname: string)
-> string?
os.remove
function os.remove(filename: string)
-> suc: boolean
2. errmsg: string?
os.rename
function os.rename(oldname: string, newname: string)
-> suc: boolean
2. errmsg: string?
os.setlocale
function os.setlocale(locale: string|nil, category?: "all"|"collate"|"ctype"|"monetary"|"numeric"...(+1))
-> localecategory: string
os.time
function os.time(date?: osdateparam)
-> integer
os.tmpname
function os.tmpname()
-> string
osdate
day
string|integer
1-31
hour
string|integer
0-23
isdst
boolean
daylight saving flag, a boolean
min
string|integer
0-59
month
string|integer
1-12
sec
string|integer
0-61
wday
string|integer
weekday, 1–7, Sunday is 1
yday
string|integer
day of the year, 1–366
year
string|integer
four digits
osdateparam
day
string|integer
1-31
hour
(string|integer)?
0-23
isdst
boolean?
daylight saving flag, a boolean
min
(string|integer)?
0-59
month
string|integer
1-12
sec
(string|integer)?
0-61
wday
(string|integer)?
weekday, 1–7, Sunday is 1
yday
(string|integer)?
day of the year, 1–366
year
string|integer
four digits
oslib
clock
function os.clock()
-> number
Returns an approximation of the amount in seconds of CPU time used by the program.
date
function os.date(format?: string, time?: integer)
-> string|osdate
Returns a string or a table containing date and time, formatted according to the given string format.
difftime
function os.difftime(t2: integer, t1: integer)
-> integer
Returns the difference, in seconds, from time t1 to time t2.
execute
function os.execute(command?: string)
-> suc: boolean?
2. exitcode: ("exit"|"signal")?
3. code: integer?
Passes command to be executed by an operating system shell.
exitcode:
| "exit"
| "signal"
exit
function os.exit(code?: boolean|integer, close?: boolean)
Calls the ISO C function exit to terminate the host program.
getenv
function os.getenv(varname: string)
-> string?
Returns the value of the process environment variable varname.
remove
function os.remove(filename: string)
-> suc: boolean
2. errmsg: string?
Deletes the file with the given name.
rename
function os.rename(oldname: string, newname: string)
-> suc: boolean
2. errmsg: string?
Renames the file or directory named oldname to newname.
setlocale
function os.setlocale(locale: string|nil, category?: "all"|"collate"|"ctype"|"monetary"|"numeric"...(+1))
-> localecategory: string
Sets the current locale of the program.
category:
-> "all"
| "collate"
| "ctype"
| "monetary"
| "numeric"
| "time"
time
function os.time(date?: osdateparam)
-> integer
Returns the current time when called without arguments, or a time representing the local date and time specified by the given table.
tmpname
function os.tmpname()
-> string
Returns a string with a file name that can be used for a temporary file.
package
packagelib
package.config
string
package.loaders
table
package.loadlib
function package.loadlib(libname: string, funcname: string)
-> any
package.searchers
table
package.searchpath
function package.searchpath(name: string, path: string, sep?: string, rep?: string)
-> filename: string?
2. errmsg: string?
package.seeall
function package.seeall(module: table)
packagelib
config
string
A string describing some compile-time configurations for packages.
cpath
string
The path used by require to search for a C loader.
loaded
table
A table used by require to control which modules are already loaded.
loaders
table
A table used by require to control how to load modules.
loadlib
function package.loadlib(libname: string, funcname: string)
-> any
Dynamically links the host program with the C library libname.
path
string
The path used by require to search for a Lua loader.
preload
table
A table to store loaders for specific modules.
searchers
table
A table used by require to control how to load modules.
searchpath
function package.searchpath(name: string, path: string, sep?: string, rep?: string)
-> filename: string?
2. errmsg: string?
Searches for the given name in the given path.
seeall
function package.seeall(module: table)
Sets a metatable for module with its __index field referring to the global environment, so that this module inherits values from the global environment. To be used as an option to function module .
pairs
function pairs(t: <T:table>)
-> fun(table: table<<K>, <V>>, index?: <K>):<K>, <V>
2. <T:table>
pcall
function pcall(f: fun(...any):...unknown, arg1?: any, ...any)
-> success: boolean
2. result: any
3. ...any
popenmode
function print(...any)
prism
table
prism.Action
unknown
prism.Actor
unknown
prism.ActorStorage
unknown
prism.BehaviorTree
table
prism.BehaviorTree.Node
unknown
prism.BehaviorTree.Root
unknown
prism.BehaviorTree.Selector
unknown
prism.BehaviorTree.Sequence
unknown
prism.BehaviorTree.Succeeder
unknown
prism.BitmaskBuffer
unknown
prism.BooleanBuffer
unknown
prism.BoundingBox
unknown
prism.BreadthFirstSearch
unknown
prism.Bresenham
unknown
prism.Cell
unknown
prism.Collision
unknown
prism.Color4
unknown
prism.Component
unknown
prism.Decision
unknown
prism.Ellipse
unknown
prism.Grid
unknown
prism.Level
unknown
prism.Map
unknown
prism.MapBuilder
unknown
prism.Message
unknown
prism.Object
unknown
prism.Path
unknown
prism.PriorityQueue
unknown
prism.Queue
unknown
prism.RNG
unknown
prism.Scheduler
unknown
prism.SimpleScheduler
unknown
prism.SparseArray
unknown
prism.SparseGrid
unknown
prism.SparseMap
unknown
prism.System
unknown
prism.SystemManager
unknown
prism.Target
unknown
prism.Vector2
unknown
prism._ISCLASS
table
prism._OBJECTREGISTRY
table
prism._defaultDistance
string
prism._defaultRangeType
string
prism._initialized
boolean
prism._itemPatterns
table
prism._items
table
prism.actions
table
prism.actors
table
prism.advanceCoroutine
function prism.advanceCoroutine(updateCoroutine: any, level: any, decision: any)
-> Message|nil
prism.astar
unknown
prism.behaviors
table
prism.cells
table
prism.components
table
prism.components.Collider
unknown
prism.components.Controller
unknown
prism.components.Opaque
unknown
prism.components.PlayerController
unknown
prism.components.Senses
unknown
prism.computeFOV
unknown
prism.decisions
table
prism.decisions.ActionDecision
unknown
prism.fov
table
prism.fov.Fraction
unknown
prism.fov.Quadrant
unknown
prism.fov.Row
unknown
prism.hotload
function prism.hotload()
prism.json
unknown
prism.loadModule
function prism.loadModule(directory: any)
prism.messages
table
table
prism.messages.ActionMessage
unknown
prism.messages.DebugMessage
unknown
prism.modules
table
prism.neighborhood
Vector2[]
Vector2[]
prism.path
unknown
prism.require
function prism.require(p: any)
-> unknown
2. nil
prism.setDefaultNeighborhood
function prism.setDefaultNeighborhood(neighborhood: Vector2[])
prism.systems
table
prism.systems.Senses
unknown
prism.targets
table
prism.turn
function prism.turn(level: Level, actor: Actor, controller: ControllerComponent)
rawequal
function rawequal(v1: any, v2: any)
-> boolean
rawget
function rawget(table: table, index: any)
-> any
rawlen
function rawlen(v: string|table)
-> len: integer
rawset
function rawset(table: table, index: any, value: any)
-> table
readmode
require
function require(modname: string)
-> unknown
seekwhence
select
function select(index: integer|"#", ...any)
-> any
setfenv
function setfenv(f: integer|fun(...any):...unknown, table: table)
-> function
setmetatable
function setmetatable(table: table, metatable?: table|metatable)
-> table
spectrum
table
spectrum.Camera
unknown
spectrum.Display
unknown
spectrum.GameState
unknown
spectrum.Keybinding
unknown
spectrum.LevelState
unknown
spectrum.SensesTracker
unknown
spectrum.SpriteAtlas
unknown
spectrum.StateManager
unknown
spectrum.path
unknown
spectrum.require
function spectrum.require(p: any)
-> unknown
2. nil
string
stringlib
string
byte
function string.byte(s: string|number, i?: integer, j?: integer)
-> ...integer
Returns the internal numeric codes of the characters s[i], s[i+1], ..., s[j].
char
function string.char(byte: integer, ...integer)
-> string
Returns a string with length equal to the number of arguments, in which each character has the internal numeric code equal to its corresponding argument.
dump
function string.dump(f: fun(...any):...unknown, strip?: boolean)
-> string
Returns a string containing a binary representation (a binary chunk) of the given function.
find
function string.find(s: string|number, pattern: string|number, init?: integer, plain?: boolean)
-> start: integer|nil
2. end: integer|nil
3. ...any
Miss locale
@return start
@return end
@return ... — captured
format
function string.format(s: string|number, ...any)
-> string
Returns a formatted version of its variable number of arguments following the description given in its first argument.
gmatch
function string.gmatch(s: string|number, pattern: string|number)
-> fun():string, ...unknown
Miss locale
gsub
function string.gsub(s: string|number, pattern: string|number, repl: string|number|function|table, n?: integer)
-> string
2. count: integer
Miss locale
len
function string.len(s: string|number)
-> integer
Returns its length.
lower
function string.lower(s: string|number)
-> string
Returns a copy of this string with all uppercase letters changed to lowercase.
match
function string.match(s: string|number, pattern: string|number, init?: integer)
-> ...any
Miss locale
pack
function string.pack(fmt: string, v1: string|number, v2?: string|number, ...string|number)
-> binary: string
Miss locale
packsize
function string.packsize(fmt: string)
-> integer
Miss locale
rep
function string.rep(s: string|number, n: integer, sep?: string|number)
-> string
Returns a string that is the concatenation of n copies of the string s separated by the string sep.
reverse
function string.reverse(s: string|number)
-> string
Returns a string that is the string s reversed.
sub
function string.sub(s: string|number, i: integer, j?: integer)
-> string
Returns the substring of the string that starts at i and continues until j.
unpack
function string.unpack(fmt: string, s: string, pos?: integer)
-> ...any
2. offset: integer
Returns the values packed in string according to the format string fmt (see §6.4.2) .
upper
function string.upper(s: string|number)
-> string
Returns a copy of this string with all lowercase letters changed to uppercase.
string.buffer
commit
(method) string.buffer:commit(used: integer)
-> string.buffer
Appends the used bytes of the previously returned write space to the buffer data.
decode
(method) string.buffer:decode()
-> obj: string|number|table|nil
De-serializes one object from the buffer.
The returned object may be any of the supported Lua types — even nil.
This function may throw an error when fed with malformed or incomplete encoded data.
Leaves any left-over data in the buffer.
Attempting to de-serialize an FFI type will throw an error, if the FFI library is not built-in or has not been loaded, yet.
encode
(method) string.buffer:encode(obj: string|number|table)
-> string.buffer
Serializes (encodes) the Lua object to the buffer
This function may throw an error when attempting to serialize unsupported object types, circular references or deeply nested tables.
free
(method) string.buffer:free()
The buffer space of the buffer object is freed. The object itself remains intact, empty and may be reused.
Note: you normally don't need to use this method. The garbage collector automatically frees the buffer space, when the buffer object is collected. Use this method, if you need to free the associated memory immediately.
get
(method) string.buffer:get(len?: integer, ...integer|nil)
-> ...string
Consumes the buffer data and returns one or more strings. If called without arguments, the whole buffer data is consumed. If called with a number, up to len bytes are consumed. A nil argument consumes the remaining buffer space (this only makes sense as the last argument). Multiple arguments consume the buffer data in the given order.
Note: a zero length or no remaining buffer data returns an empty string and not nil.
put
(method) string.buffer:put(data: string|number|table, ...string|number|table)
-> string.buffer
Appends a string str, a number num or any object obj with a __tostring metamethod to the buffer. Multiple arguments are appended in the given order.
Appending a buffer to a buffer is possible and short-circuited internally. But it still involves a copy. Better combine the buffer writes to use a single buffer.
putcdata
(method) string.buffer:putcdata(cdata: ffi.cdata*, len: integer)
-> string.buffer
Appends the given len number of bytes from the memory pointed to by the FFI cdata object to the buffer. The object needs to be convertible to a (constant) pointer.
putf
(method) string.buffer:putf(format: string, ...string|number|table)
-> string.buffer
Appends the formatted arguments to the buffer. The format string supports the same options as string.format().
ref
(method) string.buffer:ref()
-> ptr: ffi.cdata*
2. len: integer
Returns an uint8_t * FFI cdata pointer ptr that points to the buffer data. The length of the buffer data in bytes is returned in len.
The returned pointer can be directly passed to C functions that expect a buffer and a length. You can also do bytewise reads (local x = ptr[i]) or writes (ptr[i] = 0x40) of the buffer data.
In conjunction with the buf:skip() method, this allows zero-copy use of C write-style APIs:
repeat
local ptr, len = buf:ref()
if len == 0 then break end
local n = C.write(fd, ptr, len)
if n < 0 then error("write error") end
buf:skip(n)
until n >= len
Unlike Lua strings, buffer data is not implicitly zero-terminated. It's not safe to pass ptr to C functions that expect zero-terminated strings. If you're not using len, then you're doing something wrong.
@return ptr — an uint8_t * FFI cdata pointer that points to the buffer data.
@return len — length of the buffer data in bytes
reserve
(method) string.buffer:reserve(size: integer)
-> ptr: ffi.cdata*
2. len: integer
The reserve method reserves at least size bytes of write space in the buffer. It returns an uint8_t * FFI cdata pointer ptr that points to this space.
The available length in bytes is returned in len. This is at least size bytes, but may be more to facilitate efficient buffer growth. You can either make use of the additional space or ignore len and only use size bytes.
This, along with buf:commit() allow zero-copy use of C read-style APIs:
local MIN_SIZE = 65536
repeat
local ptr, len = buf:reserve(MIN_SIZE)
local n = C.read(fd, ptr, len)
if n == 0 then break end -- EOF.
if n < 0 then error("read error") end
buf:commit(n)
until false
The reserved write space is not initialized. At least the used bytes must be written to before calling the commit method. There's no need to call the commit method, if nothing is added to the buffer (e.g. on error).
@return ptr — an uint8_t * FFI cdata pointer that points to this space
@return len — available length (bytes)
reset
(method) string.buffer:reset()
-> string.buffer
Reset (empty) the buffer. The allocated buffer space is not freed and may be reused.
set
(method) string.buffer:set(str: string|number|table)
-> string.buffer
This method allows zero-copy consumption of a string or an FFI cdata object as a buffer. It stores a reference to the passed string str or the FFI cdata object in the buffer. Any buffer space originally allocated is freed. This is not an append operation, unlike the buf:put*() methods.
After calling this method, the buffer behaves as if buf:free():put(str) or buf:free():put(cdata, len) had been called. However, the data is only referenced and not copied, as long as the buffer is only consumed.
In case the buffer is written to later on, the referenced data is copied and the object reference is removed (copy-on-write semantics).
The stored reference is an anchor for the garbage collector and keeps the originally passed string or FFI cdata object alive.
skip
(method) string.buffer:skip(len: integer)
-> string.buffer
Skips (consumes) len bytes from the buffer up to the current length of the buffer data.
tostring
(method) string.buffer:tostring()
-> string
Creates a string from the buffer data, but doesn't consume it. The buffer remains unchanged.
Buffer objects also define a __tostring metamethod. This means buffers can be passed to the global tostring() function and many other functions that accept this in place of strings. The important internal uses in functions like io.write() are short-circuited to avoid the creation of an intermediate string object.
string.buffer.data
string.buffer.serialization.opts
dict
string[]
metatable
table[]
string.byte
function string.byte(s: string|number, i?: integer, j?: integer)
-> ...integer
string.char
function string.char(byte: integer, ...integer)
-> string
string.dump
function string.dump(f: fun(...any):...unknown, strip?: boolean)
-> string
string.find
function string.find(s: string|number, pattern: string|number, init?: integer, plain?: boolean)
-> start: integer|nil
2. end: integer|nil
3. ...any
string.format
function string.format(s: string|number, ...any)
-> string
string.gmatch
function string.gmatch(s: string|number, pattern: string|number)
-> fun():string, ...unknown
string.gsub
function string.gsub(s: string|number, pattern: string|number, repl: string|number|function|table, n?: integer)
-> string
2. count: integer
string.len
function string.len(s: string|number)
-> integer
string.lower
function string.lower(s: string|number)
-> string
string.match
function string.match(s: string|number, pattern: string|number, init?: integer)
-> ...any
string.pack
function string.pack(fmt: string, v1: string|number, v2?: string|number, ...string|number)
-> binary: string
string.packsize
function string.packsize(fmt: string)
-> integer
string.rep
function string.rep(s: string|number, n: integer, sep?: string|number)
-> string
string.reverse
function string.reverse(s: string|number)
-> string
string.sub
function string.sub(s: string|number, i: integer, j?: integer)
-> string
string.unpack
function string.unpack(fmt: string, s: string, pos?: integer)
-> ...any
2. offset: integer
string.upper
function string.upper(s: string|number)
-> string
stringlib
byte
function string.byte(s: string|number, i?: integer, j?: integer)
-> ...integer
Returns the internal numeric codes of the characters s[i], s[i+1], ..., s[j].
char
function string.char(byte: integer, ...integer)
-> string
Returns a string with length equal to the number of arguments, in which each character has the internal numeric code equal to its corresponding argument.
dump
function string.dump(f: fun(...any):...unknown, strip?: boolean)
-> string
Returns a string containing a binary representation (a binary chunk) of the given function.
find
function string.find(s: string|number, pattern: string|number, init?: integer, plain?: boolean)
-> start: integer|nil
2. end: integer|nil
3. ...any
Miss locale
@return start
@return end
@return ... — captured
format
function string.format(s: string|number, ...any)
-> string
Returns a formatted version of its variable number of arguments following the description given in its first argument.
gmatch
function string.gmatch(s: string|number, pattern: string|number)
-> fun():string, ...unknown
Miss locale
gsub
function string.gsub(s: string|number, pattern: string|number, repl: string|number|function|table, n?: integer)
-> string
2. count: integer
Miss locale
len
function string.len(s: string|number)
-> integer
Returns its length.
lower
function string.lower(s: string|number)
-> string
Returns a copy of this string with all uppercase letters changed to lowercase.
match
function string.match(s: string|number, pattern: string|number, init?: integer)
-> ...any
Miss locale
pack
function string.pack(fmt: string, v1: string|number, v2?: string|number, ...string|number)
-> binary: string
Miss locale
packsize
function string.packsize(fmt: string)
-> integer
Miss locale
rep
function string.rep(s: string|number, n: integer, sep?: string|number)
-> string
Returns a string that is the concatenation of n copies of the string s separated by the string sep.
reverse
function string.reverse(s: string|number)
-> string
Returns a string that is the string s reversed.
sub
function string.sub(s: string|number, i: integer, j?: integer)
-> string
Returns the substring of the string that starts at i and continues until j.
unpack
function string.unpack(fmt: string, s: string, pos?: integer)
-> ...any
2. offset: integer
Returns the values packed in string according to the format string fmt (see §6.4.2) .
upper
function string.upper(s: string|number)
-> string
Returns a copy of this string with all lowercase letters changed to uppercase.
table
table
tablelib
table.concat
function table.concat(list: table, sep?: string, i?: integer, j?: integer)
-> string
table.foreach
function table.foreach(list: any, callback: fun(key: string, value: any):<T>|nil)
-> <T>|nil
table.foreachi
function table.foreachi(list: any, callback: fun(key: string, value: any):<T>|nil)
-> <T>|nil
table.getn
function table.getn(list: <T>[])
-> integer
table.insert
function table.insert(list: table, pos: integer, value: any)
table.maxn
function table.maxn(table: table)
-> integer
table.move
function table.move(a1: table, f: integer, e: integer, t: integer, a2?: table)
-> a2: table
table.pack
function table.pack(...any)
-> table
table.remove
function table.remove(list: table, pos?: integer)
-> any
table.sort
function table.sort(list: <T>[], comp?: fun(a: <T>, b: <T>):boolean)
table.unpack
function table.unpack(list: { [1]: <T1>, [2]: <T2>, [3]: <T3>, [4]: <T4>, [5]: <T5>, [6]: <T6>, [7]: <T7>, [8]: <T8>, [9]: <T9>, [10]: <T10> }, i?: integer, j?: integer)
-> <T1>
2. <T2>
3. <T3>
4. <T4>
5. <T5>
6. <T6>
7. <T7>
8. <T8>
9. <T9>
10. <T10>
tablelib
concat
function table.concat(list: table, sep?: string, i?: integer, j?: integer)
-> string
Given a list where all elements are strings or numbers, returns the string list[i]..sep..list[i+1] ··· sep..list[j].
foreach
function table.foreach(list: any, callback: fun(key: string, value: any):<T>|nil)
-> <T>|nil
Executes the given f over all elements of table. For each element, f is called with the index and respective value as arguments. If f returns a non-nil value, then the loop is broken, and this value is returned as the final value of foreach.
foreachi
function table.foreachi(list: any, callback: fun(key: string, value: any):<T>|nil)
-> <T>|nil
Executes the given f over the numerical indices of table. For each index, f is called with the index and respective value as arguments. Indices are visited in sequential order, from 1 to n, where n is the size of the table. If f returns a non-nil value, then the loop is broken and this value is returned as the result of foreachi.
getn
function table.getn(list: <T>[])
-> integer
Returns the number of elements in the table. This function is equivalent to #list.
insert
function table.insert(list: table, pos: integer, value: any)
Inserts element value at position pos in list.
maxn
function table.maxn(table: table)
-> integer
Returns the largest positive numerical index of the given table, or zero if the table has no positive numerical indices.
move
function table.move(a1: table, f: integer, e: integer, t: integer, a2?: table)
-> a2: table
Moves elements from table a1 to table a2.
a2[t],··· =
a1[f],···,a1[e]
return a2
pack
function table.pack(...any)
-> table
Returns a new table with all arguments stored into keys 1, 2, etc. and with a field "n" with the total number of arguments.
remove
function table.remove(list: table, pos?: integer)
-> any
Removes from list the element at position pos, returning the value of the removed element.
sort
function table.sort(list: <T>[], comp?: fun(a: <T>, b: <T>):boolean)
Sorts list elements in a given order, in-place, from list[1] to list[#list].
unpack
function table.unpack(list: { [1]: <T1>, [2]: <T2>, [3]: <T3>, [4]: <T4>, [5]: <T5>, [6]: <T6>, [7]: <T7>, [8]: <T8>, [9]: <T9>, [10]: <T10> }, i?: integer, j?: integer)
-> <T1>
2. <T2>
3. <T3>
4. <T4>
5. <T5>
6. <T6>
7. <T7>
8. <T8>
9. <T9>
10. <T10>
Returns the elements from the given list. This function is equivalent to
return list[i], list[i+1], ···, list[j]
i is 1 and j is #list.
thread
tonumber
function tonumber(e: any)
-> number?
tostring
function tostring(v: any)
-> string
true
type
function type(v: any)
-> type: "boolean"|"function"|"nil"|"number"|"string"...(+3)
type
unknown
unpack
function unpack(list: { [1]: <T1>, [2]: <T2>, [3]: <T3>, [4]: <T4>, [5]: <T5>, [6]: <T6>, [7]: <T7>, [8]: <T8>, [9]: <T9>, [10]: <T10> }, i?: integer, j?: integer)
-> <T1>
2. <T2>
3. <T3>
4. <T4>
5. <T5>
6. <T6>
7. <T7>
8. <T8>
9. <T9>
10. <T10>
function unpack(list: { [1]: <T1>, [2]: <T2>, [3]: <T3>, [4]: <T4>, [5]: <T5>, [6]: <T6>, [7]: <T7>, [8]: <T8>, [9]: <T9> })
-> <T1>
2. <T2>
3. <T3>
4. <T4>
5. <T5>
6. <T6>
7. <T7>
8. <T8>
9. <T9>
userdata
vbuf
warn
function warn(message: string, ...any)
xpcall
function xpcall(f: fun(...any):...unknown, msgh: function, arg1?: any, ...any)
-> success: boolean
2. result: any
3. ...any